/dpt/ - Daily Programming Thread

What are you working on Sup Forums?

Previous thread:

Other urls found in this thread:

godbolt.org/g/qLXRpy
en.cppreference.com/w/cpp/language/constraints
godbolt.org/g/VaBFY9
discord.gg/9zT7NHP
discordapp.com/invite/0TYNJfCU4De7YIk8
discord.gg/programming
discordapp.com/invite/bmTaaS
discord.gg/reddit-gamedev
lmgtfy.com/?iie=1&q=discord
github.com/quassel/quassel
twitter.com/NSFWRedditImage

Diddling myself

post language development resources.

Perl6 will never catch on.

GREAT post

>What are you working on Sup Forums?
Virus that replaces Anime images with frogs

First for Rust is for brainlets that can't into SFINAE and zero cost abstractions

Web Dev pleb here. I know JS and Python.
I will finally get some free-time soon and I will dedicate it all of it to increasing my general programming knowledge.

Where to begin?

Any book/resource recommendations?

stupid frogposter

frog website

This.
C++ is more powerful than Rust and C++20 will make it even more powerful. Rust cannot compete.

Traits are a cheaper and more useful abstraction than OOP.

Just finished watching MiT 6.001 Structure and implementation lecture on youtube
Never knew Lisp is a beautiful and clean language

dumb frogposter

Anime website*

is Kotlin a meme?

>Traits are a cheaper and more useful abstraction than OOP.
C++ 2024 should just be Rust minus the retarded borrow checker shit.

>2018
>Can't split strings
>Can't capitalize strings
>Can't switch over strings
>Broken modules proposal
The current state of C++.

C++20 Concepts are more powerful than Rust traits.

Does C still need third party libraries to support UTF-8?

[citation needed]

>C++
>zero cost abstractions
godbolt.org/g/qLXRpy
call Foo::~Foo() [clone .constprop.6]
call Foo::~Foo() [clone .constprop.6]
call Foo::~Foo() [clone .constprop.6]
call Foo::~Foo() [clone .constprop.6]
add rsp, 8
jmp Foo::~Foo() [clone .constprop.6]

Agreed.

I can't create trait objects, so I don't care.

en.cppreference.com/w/cpp/language/constraints

ageru

Sepples compilers are shit, the semantics of the language itself are suitable to get the behavior you want.

kek

C++ compilers are the best compilers out there, the semantics of the language require a moved-from object to keep empty-but-valid state thus requiring from compilers to call destructors on moved-from objects. In other words, C++'s move isn't really a move, but a copy + reset to the "empty-but-valid" state, meanwhile, Rust's move is an actual move, i.e. the moved-from value is disregarded entirely.

C++ can't really move.

Computer systems: a programmers perspective
The book is focused on C and low level stuff, really good stuff

That is because that part of C++ was designed before we knew how to track object lifetimes reliably.
We still don't know how to track object lifetimes reliably (Rust included).

>no trait objects
eh
aside from that I don't see how that is any better that what Rust has, and I'm saying that completely overlooking all of the sepples buzz in the syntax.

L I N E A R
T Y P E S

Swift would like a word.

Linear types are shit and not worth it.

__attribute__((noinline))
Really makes u think

>Linear types are shit
t. knows absolutely nothing about them

can you stop spamming these threads on Sup Forums, please? generals shall move to discord.

>discord

>grapes are sour and not worth it

Linear types will save systems programming

>Objects are used exactly once. No less, no more.
They're shit. Fuck off.

Fuck back to Sup Forums

there's also weighted types which haskell is experimenting with.

>Maintainer merges my PR despite CI fails
What am I in for?

So I'm creating an e-commerce website for a company (my first time and I'm and I'm doing it solo) and I've hit my first hurdle where I'm not sure what the most elegant way to solve this problem would be.

Each state they sell their items to has a different, supplier each supplier has a different cost, so every state has a different price (i'm in Australia though, we've only got like 6 states or something).

I was thinking of adding a drop down menu in the navbar to choose which state to ship to, which would change the product price and shipping. Is that how you guys would go about it? I feel like this way would definitely work but it feels kind of ugly.

>We still don't know how to track object lifetimes reliably (Rust included).
Rust has lifetime parameters.

>C++ compilers are the best compilers out there
Rusts compiler is written in Rust (selfhosted) although his first compiler was written in C++, so you could say Rust is compiled by a compiler written in C++. Both using LLVM mostly btw

Enjoy not knowing when to free objects

craftinginterpreters.com, for when you have to do it beside your job or something

>Rust (selfhosted) although his first compiler was written in C++
Wasn't it OCaml?

oh shit you might be right. But though it rans over LLVM

Rust excluded.
It's for demonstration purposes only, the end result is still 5 prints in C++ and 1 print in Rust.

Rust included.
Proof: The introduction of NLL

answer my fucking question, is Kotlin a meme?

Yes, of course.

NLL doesn't change the semantics, it just makes borrow checker fine-grained.

>We still don't know how to track object lifetimes reliably
If you figured out how to "track object lifetimes reliably", you would solve the halting problem. Your options are varying level of conservatism or letting the user figure it out on a case-by-case basis.

Discord has killed irc and is going to do the same with text/image boards.

The only thing Discord has killed is my patience because it's such a horrible fucking lagfest. It is literally the most bloated piece of shit I have ever used and it almost doesn't work.

> the end result is still 5 prints in C++ and 1 print in Rust.
The behaviour you want is to print precisely 1 time, to coincide with the destruction of a non-empty object.
godbolt.org/g/VaBFY9
Fancy that. Turns out in practical C++ code (i.e. where destructors are inlined and dead code is elided) they behave exactly the same way.

now explain the reason

i am connected to several channels with thousands of online users and have no problem at all.

...

the desktop client is okay, the web client is ass.

It's Electron, the desktop client literally is the web client.

last i checked the web client still doesn't have global mic toggle.

>what are strong reference cycles?
>muh weak var

On one hand, you're right, but on the other hand, the two are basically the same. The only main difference is that the desktop client can do a bit more. Performance-wise, Electron is Electron.

Is it possible to self teach through online resources and get a job as a programmer in a year or so if I'm diligent about it?

Thinking about starting wtih Java but trying to figure out what the best place to start with.

Also would you recommend picking up any books to start or do they work better once you have learned a programming language?

>a year
still underqualified even for webdev, but it's not like it matters in the current year since web devs are hired out of month long bootcamps.

>Sup Forums
>What Sup Forums has to do here?

Yes. If you are very diligent. Make sure you have a GitHub with a portfolio of code you've written to make up for lack of relevant work experience and degree.

Discord is for video game players.

Really? Who said that? Never i have used it for gaming, only for programming or anime/roleplay.

I only ever used discord in WoW when needed for raid... Why would you even be on programming discord is beyond me.

It's much better than irc, everyone has moved here.

>programming
Recommend me a server.
>anime/roleplay
I know "anime website" and all, but that second part is indefensible. Please, for your own good, stop.

any good channels?

>everyone

...

Programming Discussions (2000+ online users)
discord.gg/9zT7NHP

Game Dev League (5000+)
discordapp.com/invite/0TYNJfCU4De7YIk8

The Programmer's Hangout (2000+)
discord.gg/programming

Programming (300+)
discordapp.com/invite/bmTaaS

Reddit/r/gamedev (300+)
discord.gg/reddit-gamedev

DELETE THIS!!1!

>Really? Who said that?
lmgtfy.com/?iie=1&q=discord

Freenode
average of 87078 users

OFTC
average of 12679 users

DISCORD BTFO

The only other medium I've seen ACTUAL devs use besides IRC is gitter. Discord is basically full of beginners and larpers.

Isn't it supposed to do that since you're creating an object each time?
If it doesn't, how would shared pointers work because it needs to increment and decrement the ref counter

Use const && or just const &

the biggest programming channel is #python with ~2000 users.
the programming channel has only ~750 users.

>average of 87078 users
discord has an average of 14 millions unique users per day.

>gitter
does it has vocal chatting?

Virtually all channels on Freenode and OFTC are related to programming.

Go learn Racket

>does it has vocal chatting?
No.

Discord is proprietary, centralized and data-mined for every single bit of usable private information.

And Slack too, there's a C++ community out there. But I believe IRC remains dominant to this date.

lot of non programming channels like #gaygeeks, #windows, #politics, ...

but it's free as in free beer.

>const &&
what's the point

>discord killed IRC

>IRC.
>Client/server architecture.
>Not centralized or data mined.

Who mines IRC users?

Speaking of, what client do you use?
I've been using Quassel.
github.com/quassel/quassel

Right now I am doing nothing. Later I will walk to the local Walmart and purchase some fodder (read: chips, soda & USB transfer cable). After that I will do some godot tutorials, methinks.