/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/rust-lang/rust/issues/24111
godbolt.org
open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0385r0.pdf
open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0707r0.pdf
twitter.com/AnonBabble

fuck opengl, though

Lisp is the most powerful programming language.

useless*

too bad all the implementations suck

I am working on shaders.

Is that the "shitposting on Sup Forums with a compressed youTube jpg" one?

No, just a box blur. Of course, I probably could make ones for shitposting about bad graphics.

that's clearly a blur filter. if only jpeg compression artifacts were that consistent, lol

>that's clearly a blur filter
it's clearly a Gaussian blur filter

Rust is a better functional programming language than Haskell, has better metaprogramming than Lisp, and better safety than Java. There is literally no excuse. If you don't make use of Rust's extremely expressive and concise zero-cost abstractions and safety features, you are a confirmed brainlet who should not be allowed to program.

So, what did you do with Rust recently?

Post some projects.

Oh, I forgot to add: it is much faster than C++.

>what did you do with Rust recently?
I can't, because unlike you, I do real work and it's proprietary code, but I assure you, Rust has significantly increased productivity at my work place over C++.

>has better metaprogramming than Lisp
Objectively wrong.

>Rust is a better functional programming language than Haskell
I don't even like haskell but that's bullshit.
Here's your (You)

Do you even do systems programming? Why do you think your opinions matter?

Because they are not yours.

Tell me why you think Rust is a better functional language than Haskell.

>my opinions matter because they don't belong to someone who knows what he's talking about
Checks out.

>Tell me why you think Rust is a better functional language than Haskell.
Because it has real and zero-cost functional abstractions.

Who are you quoting?

AHAHAHAHAH

kys brainlet

>if you don't use my meme language you're a brainlet
>here's some some sales pitch buzzwords and unbacked assertions to make my case

>has better metaprogramming than Lisp
HAHAHA, Rust doesn't even have metaprogramming.
Generics != metaprogramming.

read this sentence.

>what are macros

How are interfaces implemented in Java?
If iexample is some interface type, then what is the representation of iexample in memory? An object reference plus a method table pointer? Or is the method table pointer intrusive in the object?

No one said this. Please cite your sources.

A pile of shit?
Compute a value at compile time using macros, and pass it as a generic parameter.

>rust has metaprogramming
crutch for broken languages

Rust still has them and therefore metaprogramming.

>real and zero-cost functional abstractions.
false

So Rust has metaprogramming, but you can't compute values with them nor can you pass them to generics?
Lmao, Rust has pretty shit metaprogramming abilities.
Rust will never surpass C++.

For computing at compile time Rust has const fn (nightly). Rust doesn't have value generics yet. "Never" is a strong word.

Until Rust gets proper metaprogramming, fixes their borrow checker, and gets MUCH better platform support then they have now, Rust will never surpass C++.

>rust doesn't even have CTFE
wwwwwwwww

>t. jealous brainlet
How does it feel to be stuck with inferior languages just because you're too much of a brainlet to comprehend Rust?

Rust will never be relevant, sorry to burst your bubble.

>inferior languages
D is leagues ahead of Rust.

>Until Rust gets proper metaprogramming...
>Rust will never surpass C++
But C++ itself has never had, and will never have, proper metaprogramming.

github.com/rust-lang/rust/issues/24111

t. retard.
Rust isn't hard, it's just lacking features that C++ has had for a while. And their borrow checker is too coarse for non trivial programming.

>Rust will never be relevant
C/C++ will never be relevant again. Sorry to burst your bubble. It's over for you.

>unsafe
>not stable
Try again.

That certainly speaks volumes about the worth of Rust's metaprogramming ability.

So, what did you do with Rust recently?

Post some projects.

>it's just lacking features that C++ has had for a while
C++ language crutches are not "features".

lol rust is not even programming language.
It's hardly working.

>What is constexpr
>What are templates with non type parameters
And in 2020, C++ will be getting compile time reflection too.

>I don't like them so I'll call them crutches instead!

>unsafe
That bullet point is about "const unsafe" vs. "unsafe const". const fns are not inherently unsafe.

>That certainly speaks volumes about the worth of Rust's metaprogramming ability.
I don't care. I'm just interjecting to point out that neither one has proper metaprogramming facilities. Simply computing things at compile time does not a program make.

Well it's still not even an official part of the language.

Lmao. C++ is still very relevant and will likely remain that way for a very long time.

>Simply computing things at compile time does not a program make.
This is wrong.

Unstable does not mean unofficial. Of course it's official.

>le ebin rust shilling again
for the sake of people actually posting here, fuck off already
Rust is not completely useless, but it lacks a lot. Just stop for once because you will not convince anyone by posting here,

I mean a properly implemented feature.

I'm afraid not, it's a box blur.

>>What is constexpr
>>What are templates with non type parameters
Babby-tier "metaprogramming" that only Sepples monkeys are impressed with.

>And in 2020, C++ will be getting compile time reflection too.
Which still won't bring it anywhere near having real metaprogramming facilities. Call me back when C++ lets you conveniently manipulate and transform your program's syntax tree and allows you to create new syntactic forms.

>Call me back when C++ lets you conveniently manipulate and transform your program's syntax tree and allows you to create new syntactic forms.
Give me your number then, so I can call it in 2020.

Nobody cares about your Lisp wankery, we're discussing systems programming languages here.

> C++ lets you conveniently manipulate and transform your program's syntax tree
I watched the Nim talk on that and i still don't understand why it's useful.

>This is wrong.
No, it was poorly worded. My point was that computing values at compile time does not, in and of itself, generate a program. Compile-time programming =/= meta-programming. When it comes to actually generating a program, your options are extremely limited by plugging in values into holes in a template.

>Babby-tier "metaprogramming" that only Sepples monkeys are impressed with.
What is constexpr
What are templates with non type parameters
>Which still won't bring it anywhere near having real metaprogramming facilities. Call me back when C++ lets you conveniently manipulate and transform your program's syntax tree and allows you to create new syntactic forms.
And in 2020, C++ will be getting compile time reflection too.

Macros. Text substitution is just shit.

>we're discussing systems programming languages here
Nobody cares about your anti-lisp wankery. We were discussing metaprogramming, and how C++ has very limited support for it.

#define

>Text substitution is just shit.

>>What is constexpr
>>What are templates with non type parameters
Babby-tier "metaprogramming" that only Sepples monkeys are impressed with.

>And in 2020, C++ will be getting compile time reflection too.
Which still won't bring it anywhere near having real metaprogramming facilities. Call me back when C++ lets you conveniently manipulate and transform your program's syntax tree and allows you to create new syntactic forms. (Protip: that won't happen in 2020, or ever)

Arrays in enums? Is it possible in C++? Some recursive templating?

>Macros.
Could you give a simple example of where macros would be superior to a template?

You were discussing metaprogramming in the context of Rust and C++. Unless you can mention a language with comparable performance and semantics to those with superior metaprogramming, nothing you have to say is relevant.

Are you okay?
You're not coherent anymore.

In python, how would you go about parsing a string holding various formats of dates (e.g. 1/3/2000, Jan 3 2000, etc) into a standardized format, without external libraries?

Timestring would've worked well but I'm taking a pre-employment test and the platform doesn't let you import any libraries except their """approved""" ones. -_- wtf brah

> (Protip: that won't happen in 2020, or ever)
Which still won't bring it anywhere near having real metaprogramming facilities

>Call me back when C++ lets you conveniently manipulate and transform your program's syntax tree and allows you to create new syntactic forms
And in 2020, C++ will be getting compile time reflection too.

I don't think you understand what an enum is.

What do you mean? An array indexed by an enum?

t. enum-ale

If you aren't allow to import code, what makes you think you're allowed to ask for help online? :^)

>I watched the Nim talk on that and i still don't understand why it's useful.
I don't know what Nim provides, but proper metaprogramming lets you create your own specialized syntax constructs, effectively letting you create features and abstractions that your programming language lacks. For instance, it would allow you to add support for C++-like OOP in a C-like language.

They said i can't use the import keyword

i have to re-write every function from those libraries by hand

>He pronounces enum "enoooom"
Fucking retard

A macro that takes an identifier, converts it to a string to look up a symbol in a dynamic library, and initializes a variable named after the identifier with the result.

Why does a dog lick its balls?

Because it can :^)

Also, wasn't me. Wtf.

>You were discussing metaprogramming in the context of Rust and C++.
I was noting that neither C++ nor Rust have any serious support for metaprogramming.

>mention a language with comparable performance and semantics to those with superior metaprogramming
This is completely irrelevant. You can screech about C++ performance all you like, but it doesn't make its metaprogramming facilities any less inferior.

This wasn't me.

wtf

Are this code will compiled to similar asm code??
int a;
void b(int x)
{
if (x)
{
a = 1;
return;
}
else
{
a = 0;
return;
}
}
int main()
{
b(1);
if(a)
{
return -1;
}
else
{
return 0;
}
}

and
void b(int x)
{
if (x)
{
throw (int)(1);
}
else
{
return;
}
}
int main()
{
try
{
b(1);
}
catch (int x)
{
return -1;
}
return 0;
}

>and initializes a variable named after the identifier with the result.
But why?

godbolt.org is your friend, ESL-kun
"Will this code compile to the same ASM"

>Could you give a simple example of where macros would be superior to a template?
Defining a custom struct syntax that automatically generates binary diff, serialization, deserialization and interpolation methods based on the struct fields and custom keywords that determine which fields use what type of interpolation, and which fields are ignored in the binary format.

So that you don't have to duplicate the information? Instead of:
FARPROC foo = GetProcAddress(library, "foo");
FARPROC bar = GetProcAddress(library, "bar");

You have:
#define LOOKUP(symbol) FARPROC symbol = GetProcAddress(library, #symbol);
LOOKUP(foo);
LOOKUP(bar);

won't even work lmao

C++ has a few papers for compile time reflection and meta types.

Static reflection: open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0385r0.pdf
Meta classes: open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0707r0.pdf

Both seem pretty cool desu.

Now sepples can finally have interfaces!

i feel like reading some lisp programs what ones use useful metaprogramming features

C++ already has interfaces.

A type of descriptions and a description-indexed type family is even better.

ABCs introduce intrusive vptrs under just about implementation and may also introduce instance data members, while real interfaces don't affect object memory layout and can't introduce instance data members.