/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 9e6367b2-acd2-45d2-c508-f1cefc1c6fa3.png (2560x1440, 2.37M)

Other urls found in this thread:

pcg.wikidot.com/category-pcg-algorithms
en.wikipedia.org/wiki/Complex_data_type#Language_support
dlang.org/phobos/std_complex.html
dlang.org/phobos/core_stdc_complex.html
make.girls.moe/#/about
makegirlsmoe.github.io/assets/pdf/technical_report.pdf
nim-lang.org/docs/manual.html#statements-and-expressions-assembler-statement
twitter.com/SFWRedditGifs

Karen kujo would program in Haskell

lol

What are the cool ways to do text based AI? The two ways is either shitty conversation based where the AI has to talk to others and learn from that or where you manually enter the different topics and pretend it's an AI.

waifu caption generation for notification system

Attached: 2018-11-19-001348_1493x1185_scrot.png (1493x1185, 806K)

How much faster does C++11+ compile compared to legacy C++, if at all?

What kind of interview will a software engineer apprenticeship be like?

Is RUST being shilled because nobody wants to use it or is it shilled because its actually good and people are starting to use it?

Attached: 367373467.jpg (477x477, 41K)

Because nobody is using it.

rust shills have tried periodically to try, with little success.

C++ versions don't get faster inherently. That's just due to how they build their language.
But certain features like move semantics allow you to specify more constraints that allow you to express things more efficiently without hindering the compiler too much.

Only Mozilla use it

It compiles slower, if anything.
The trend in Modern C++ is to perform as much work at compile time as possible.
However, the trend will probably reverse when Modules gain widespread adoption.

Thats wrong.
I know big money guy in Norway that uses is

Sorry. I'm a dummy who can't read properly.
There's no compile speed gains at all. They only add more complications. Especially for parsing which has been an issue for C++ for a while now.

Thinking of redesigning Rust without the BC (but might keep unsafe) with overloading, strong metaprogramming, CTFE, static reflection, metaclasses (metatraits), type manipulation, automatic parsing of C headers to generate FFI interfaces, etc. Along with whatever other minor changes I could make along the way.
The other parts of Rust are pretty nice. Enums & pattern matching / destructuring are excellent, statement expressions are nice, static methods instead of constructors is a good idea. Unsafe is a good way to tell the programmer "You probably shouldn't be calling this function unless you know exactly what you're doing".
If you just removed the damn borrow checker and added in the cool stuff in C++ it'd literally be the perfect programming language.

stutter wants to adding a BC to C++ btw lol
imaginie thinking its easier to redesign an entire language isntead of just writing safe code...

>with overloading
No, stronger type inference + return type "overloading" is more useful than adhoc overloading.

I think such a BC would be conservative in the opposite direction which is honestly a good thing desu

Because Rust doesn't accept safe code. It accepts code that makes it's BC happy.
{code BC accepts} is a subset of {safe code}, and that subset is too small.

>type inference
irrelevant to overloading
>return type "overloading"
explain

>return type "overloading"
If that is what I think it is, that's fucking stupid.

Fuck this shitty language so much. Why the fuck are there so many ways to do one thing? OOP was a mistake.

Attached: 306px-ISO_C++_Logo.svg.png (306x344, 15K)

There is literally nothing wrong with having multiple ways to do the same thing.

Name one other language with complex number support as base language feature. I'll wait.

I find it's a useful feature. Consider this code.
enum Foo {
Value(i32),
Nothing,
}

fn main() {
let bar = [1, 2, 3];
let foos : Vec = bar.iter()
.map(|x| Foo::Value(*x))
.collect();
}
Foos is inferred to be a Vec, but I didn't have to annotate the type parameter Foo. I didn't have to annotate the collect function's type parameter either - without generalized overloading, there's only one possible instance of the polymorphic function collect which could return a Vec.

That's literally C.

C.

That's called type inference.

Making a pygame roguelite. It's going to be a fantasy/survival/trading game. The game is 2d tile based. Right now I generating maps like pic related and then chopping the map into blocks to load into the game. There is a world map which is built from the generated image, and a local map which consists of 32x32 tile maps for each tile in the world map.

Attached: map.png (523x396, 26K)

vscode, yes or no?

Also is it really portable as it works from a pendrive and doesn't need to access c:\ or to meddle with any of temp or setting folders?

Does it support python and running python without having any other python interpreter or IDE installed?

It's a more powerful version of type inference that's only possible in those languages that reject generalized overloading (usually those which take inspiration from Hindley-Milner type systems like Haskell).
Languages which have arbitrary overloading like C++, Java, C#, Scala can't do this.

This is what the tilemap looks like in the game.

Attached: screenshot.png (1176x664, 144K)

>Have grand idea for something I want to implement
>Spend a solid 4-5 days in a row working on it
>Have to stop working on it for a couple of days, because I had other shit I had to do
>Lose all momentum, can't be fucked working on it
God damn it, this always happens.

Attached: 1470828563452.jpg (477x465, 48K)

Looks nice
Good luck friend

It's literally just normal type inference.
The type parameter of collect is deduced from map and then the type parameter of Vec is deduced from collect.
There's nothing special going on there and it's completely unrelated to overloading.

Is this randomly generated? I've always been meaning to look up how that and procedural generation are done, especially for creating environments and stuff.

The worst is when you do want to work on it but don't remember what you were doing or what anything does.

You're wrong, the type parameter of collect is deduced from the type hint on the let binding.

That's me when it comes to everything in life.

Wrong because it's literally impossible.

Yeah, each of the pixels in determines which tile is drawn where. Luckily there were a couple modules in python that made it pretty easy to implement the generation.

I guess that just means you never had a real use for it. If you want to make something you will actually use, you tend to stick with it until you're done so that you may have your use case fulfilled. At least that's what I do, most of my complete non-work projects are things I've made because they're useful to me on a daily basis, be it small scripts or bigger programs.

>He's afraid of writing IDIOMATIC C++
#include
#include
#include

auto
f() -> int
{
auto v{ std::array() };

std::generate(v.begin(), v.end(), [n = 0]() mutable { return n++; });

return std::accumulate(v.cbegin(), v.cend(), 0);
}

That's literally how it works.
How else do you explain this code?
use std::default::Default;

struct Foo {
t : T
}

fn make_foo() -> Foo {
Foo { t : Default::default() }
}

fn main() {
let foo : Foo = make_foo();
println!("{}", foo.t);
}

Why are futures and promises two seperate types?

God I wish that were me.

>complex number support as base language feature
Why is this the number one feature you bring to defend C++'s existance?
>I've been meaning to look up
pcg.wikidot.com/category-pcg-algorithms
This is a great collection of resources.

>The worst is when you do want to work on it but don't remember what you were doing or what anything does.
Fortunately, this is for an open source thing, so I had to spend a bit of effort explaining and justifying what I wanted to do to the other developers (which is written down), so that's not an issue here.

This is for a library, and is a big redesign of the core of it. It's definitely useful and I certainly want it to happen, since it's needed to add a bunch more features to our library.
I even have people waiting on these changes.

Part of it is that I just took on a huge task. I have a WIP pull request that is 1000 lines in, and I would guess I'm only 20% done.

Are you fucking stupid?
en.wikipedia.org/wiki/Complex_data_type#Language_support

In that example yes but not the one you posted before.
In the one you posted before, the information to deduce Foo can not be done by only looking at the left. It's 100% impossible.
The Rust compiler looks at other surrounding information to deduce Foo.
If you disagree with me you are literally arguing that magic is real.

dlang.org/phobos/std_complex.html

Well, yes. It deduces Vec from the outside and Foo from the inside.

See? That's what I've been saying.

To me, you'll always be a cute loli, user.

Sure. Rereading I see that's what you've been trying to highlight.

But the main point I was trying to emphasise was that inference from both sides is possible, unlike languages with unstructured overloading which can usually only deduce types from subexpressions.

>Unironically posting links to necrophilia websites

Attached: 1374577061478.png (303x323, 119K)

>d(ead)lang
F

Attached: DZyUGd9VoAIuRCf.png (800x700, 321K)

>d-ded, d-doesn't count!
wwwwwwwwwwwww

Common Lisp

Jow Forums nerds have the weakest banter

>t. andrei and the other guy

oof

walter unironically posts on reddit, so no chance of him being here.

D technically has 2 complex APIs
dlang.org/phobos/std_complex.html
dlang.org/phobos/core_stdc_complex.html

>posts on reddit, so no chance of him being here
This logic doesn't hold up in 2018.

One for each of their users. How considerate of them.

> C stdlib is built into D
Didn't know that. Nice.

>D
Not programming.

>Imagine getting triggered by a programming language

>Imagine getting this defensive about a corpse

What programming language?
We're talking about D.

This is currently driving me nuts lol. Choices, choices. Do I go for speed, safety, convenience, code clarity, modern idioms, etc.

There is though, especially when the differences are very subtle. Not to mention the paradox of choice.

sigh

Attached: 1542612052052.png (1004x1000, 404K)

you lads really need to come up with more jokes.
The whole
>lmao ded lang lmao necrophilia
>lmao 2users
stopped being funny 10k times ago.

Posting that joke of a language wasn't funny either.

come up with a decent third joke and i promise i'll never bring it up for the next year.

"D-lang? More like Deceased-lang."

public Epic getEpicness() {
return this.epic;
}

just a rehashed "lmao ded"
try again.

I wish they'd try again with D.

"D-lang? More like Desolate-lang."

little obtuse, but better.
embarrassing

Here's a joke:
D
It's funny because of the GC.

now this. is epic

I'm stuck and have no idea of what to do. There's no projects that I want to do but I want to do something. Maybe with AI or ML? I hear those are annoying right now and kind of agree. Maybe something to do with anime or video games because that's all I have really. Please respond.

Attached: 1396571416586.jpg (278x278, 34K)

get into cryptography, it's fun

contribute to emulation.
contribute to deepcreampy
make a game
train a computer to make a game
train an AI to come up with video game / anime stories/ characters / concepts.
teach an AI to learn your taste in anime/video games and scrape the web for things you may also like.

>want to get into AI
>also want to use C
Fucking hate python and don't really enjoy C++ but it's all there is unless I want to implement everything myself, which I might anyway.

make.girls.moe/#/about
makegirlsmoe.github.io/assets/pdf/technical_report.pdf

Shill me a systems programming language that you could write an OS in that isn't C/C++/rust, must be able to inline asm

Why is type theory important and why only unemployed autistic left-leaning "programmers" seem to care about it?

Stop being dumb and just use C.

Anyone have experience with OCR?

Nim
simple syntax
optional whitespace or curlies
GC is completely optional, or extremely fine-tunable
compiles to C
nim-lang.org/docs/manual.html#statements-and-expressions-assembler-statement

No, i'll be dumb if I want to

If you were designing a BetterC, what would its compilation model be? Would it have templates/generics? If so, how would you solve the problem of duplication/interoperability of these generics between different modules/compilation units?

Attached: 1535894306540.jpg (720x540, 26K)

An acquaintance of mine actually managed to enter Nim code from the bootloader and actually do some tuff in it. So it is in theory possible to write an OS in Nim.

Correct.

Attached: haskell.png (1280x719, 818K)

Based and redpilled japanese.

this

Attached: b8c12a3b80d1e494a8ef5a11682967c3.png (1107x938, 145K)

nope