/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Old thread:

Attached: 1557992248664.png (443x739, 751K)

Other urls found in this thread:

boats.gitlab.io/blog/post/zero-cost-abstractions/
stackoverflow.com/questions/837577/how-to-serialize-a-generic-javascript-object-to-xml
twitter.com/NSFWRedditImage

HolyC compiler in HolyC, but on Linux.

Attached: 1520985891840.png (1920x1090, 1.57M)

>2 months into no energy to code for fun because uni and work is taking up all my time

Attached: I hade enough witcher.jpg (600x600, 184K)

Python the Hard Way

boats.gitlab.io/blog/post/zero-cost-abstractions/

very smart fox

nth for Nim!

what anime is that?

How many Rust blogposts are there now? A million?

Currently failing horribly at beginner exercises.

old thread didn't reach bump limit, you fat fuck

We all failed at some point. Only he who persists may see the light at the end.

Woah, you can do THAT in JavaScript? Why haven't you told me before, user?!

Attached: 939296fc3d0a8729ddbc09a8506002bd.jpg (684x1024, 86K)

Starting my master's because anons told me can't into Google with a bachelor.

do what retard

you won't into with a master's either, need a post doc

That's fine, just wait until he finishes his master's degree and comes back asking about a Google job, then you can tell him he needs post doctorate.

Ruby 3x3 when?

just keep going to school until Jow Forums tells you to stop

That's good, I trust you guys. Might start math after CS phd for that sweet 300k starting.

Don't call dolls retards.

stackoverflow.com/questions/837577/how-to-serialize-a-generic-javascript-object-to-xml

WTF!? I rewrote a slow Python program in sepples for performance and it's only twice as fast. That was like a whole hour of effort for very little performance increase.

Attached: 1554845022557.jpg (703x675, 43K)

Updating my git cleanup program. It can now delete folders.

Someone from some days ago asked what's wrong with BFG: It has no GUI and I don't like being preached about Orange Man Bad when I use a supposedly apolitical program.

With my program you can choose files to delete from a list, or a folder from a tree, with checkboxes.

How do I construct a value of type
type Assoc k v = [(k, v)]
I keep getting errors saying the data constructor is not in scope.

Learning D.
It's comfortable and familiar and is just full of little quality-of-life features that I'd otherwise just say fuck it and run off to Python for.
Just did a prime finder that runs in parallel for practice.

Kinda wish the documentation was a little nicer in spots.

Attached: 2019-05-16-180327_484x316_scrot.png (484x316, 7K)

post code

you don't have a data constructor is why

derp

Can someone explain why bilinear interpolation sometimes fails? i.e.
def bilinear2(xData, yData, x, y):
# xData[0]

-O3

Why is making a fast interpreter so hard. I can make compilers that approach C speed depending on the language but making an interpreter anywhere near as fast as Python is ridiculously hard. Why? Is there some sort of interpreter performance secret I do not know?

What is your current approach?

>making an interpreter anywhere near as fast as Python is ridiculously hard

cpython is really slow and has a very naive implementation.

JIT

I'm learning C++. I made a small Choose-Your-Own-Adventure that uses numbers 1 and 2 as inputs, anything else resulting in not a valid option, using my friend Mr. While((name of variable you want to call it) != 1 && (name of variable you want to call it) != 2). It's been running in exclusively terminal mode on Visual Studio 2019. VS2019 is because I have a windows PC and it's one of the more easily available IDEs for me, and Terminal mode because FUCK SETTING UP A "WINDOWS DESKTOP APPLICATION" IN VS2019

what's your point?

I construct an object for each function with its AST and then whenever I call it I create a Frame object will all the local data for that function and traverse the AST.

A JIT is a compiler executed at runtime, not an interpreter. An interpreter doesn't compile any code, it just parses text and executes.

making an interpreter faster than cpython is easy. constant folding + pre decoding will give you that.

It's easier to make a compiler than a JIT though, so there's no point unless you're really attached to having an interpreter.

exactly, and the reason why some languages have competitive speed (lua, javascript etc) is because they implement jit, not because they're purely interpreted

i want to nakadashi senko

poster was asking about interpreters not compilers, a JIT is an entirely different approach with it's own complications.

Okay weeb

Can you point me to the interpreter for your programming language that's faster than CPython? Thanks.

An interpreter shall execute bytecode, not strings.

SBCL.

nekovm is much faster than cpython. luajit interpreter too.

>reading comprehension/10
I wasn't asking for an interpreted language implementation that can run faster than CPython, I could list dozens of examples myself (although most languages don't even come close feature/usefulness wise to Python) but for /your own/ implementation of an interpreter that's faster than CPython, since it's so easy I figured you'd be able to provide me with one so I know you're not just a random retard that's spouting that something is easy while being incapable of doing it himself.

>incapable of doing it himself
I am one of the top contributors to SBCL.

Sure you are.

Your insecurity is showing. Try studying harder, maybe one day you'll be able to contribute to something nice too.

based.

>decide to try out C
wow, it's like if C++ had a retarded uncle or something

I'm pretty sure C++ is the brain-damaged nephew in this case.

They’re both garbage.

>C and C++ are garbage
Then Java is the fucking antichrist.

The worst thing Java ever did is be verbose. C is featureless and sepples is undebugable.

Fuck, I got the Emacs itch again. I'm gonna install it, spend 3 hours fiddling around with it, decide it's not for me and feel like I wasted my afternoon. Like fucking clockwork.

There's no hurry. Just keep your progress around for the next time you decide to play with configuring it and eventually you'll feel more comfortable. That's what I did.

Verbose? Bitch that's an understatement, It's long-winded prolixity pisses me off.

Everything in sepples is a pain in the ass.
>Yeah, if you're a shitkid programmer with no real world experience.
No, no matter how much real world experience you have, everything in sepples is a pain in the ass. Because it's not a matter of being difficult to understand. It's a matter of how the STL is structured. Doing anything more complex than input, output, and arithmetic requires hundreds of lines of code per small individual task, and if you actually understand what you're doing, typically the result of that understanding is that you have to write even more code, not less. It really says something that a beginner stumbling through a mess of compiler errors will tend to wind up with a leaner, cleaner solution than someone who knows the language inside and out will think to write in the first place. The language is just that bad. It breaks people.

Attached: tenor (26).gif (310x466, 1.76M)

an AST isn't strings

>no matter how much real world experience you have, everything in sepples is a pain in the ass
only beginners spend their time wrestling with standard libraries

> It really says something that a beginner stumbling through a mess of compiler errors will tend to wind up with a leaner, cleaner solution than someone who knows the language inside and out will think to write in the first place.

To which I answer with another quote by Stroustrup:
>"Within C++, there is a much smaller and cleaner language struggling to get out". Yes, that quote can be found on page 207 of The Design and Evolution of C++. And no, that smaller and cleaner language is not Java or C#. The quote occurs in a section entitled "Beyond Files and Syntax". I was pointing out that the C++ semantics is much cleaner than its syntax. I was thinking of programming styles, libraries and programming environments that emphasized the cleaner and more effective practices over archaic uses focused on the low-level aspects of C.

What are you going to use it for?

>C is featureless
It has everything you need

Started taking dexampetamine
Going strong @ 3 days w/sleep
70% of the time is spent programming.
Its like im in a dream bros - always focused and dont have to sleep until i crash (hopefully in 24+ hrs). Is this what it feel like to be a 10x ?

Except the things it doesn’t that you need Posix for.

I don't need drugs; I have OCD

Exactly, which is why code written by people who are not beginners is disgusting and awful. Learning the standard library simply means learning to love taking abuse from the standard library. There is no elegant way to work with it because it's garbage. And there are """people""" who sit there and use it anyway and call it good. It's not any less of a pain in the ass for them, they've just repressed all such feelings.

Drugs only help with work
They don't help you make good decisions
You can work faster but big projects will fall apart

>which is why code written by people who are not beginners is disgusting and awful.
t. beginner

I do believe that was written in jest.

Ive to expect that high amount of work > intelligent way of aproaching work even though I doubt it inhibits my thinking - enchances it if anything.
I have adhd and so i just feel really good and dont get a high that someone else might - although Im getting hallucinations from sleep deprivations. Have an exam in 2hrs anyway

why not just write a gui for bfg then

Nope, been using it for 10 years. I remember when I really was a beginner, so frustrated with the holes in C++98's feature set because I wasn't good enough yet to implement anything myself. I so eagerly looked forward to the innovations to be introduced with C++11. How blissfully naive I was to think anything that was to come was worth looking forward to.

>Ive to expect that high amount of work > intelligent way of aproaching work
that depends if you're an employee or not
in only enhances your thinking in the short term
every developer I know who takes drugs fucks things up in the long term, they choose projects that are immediately gratifying but don't lead anywhere

Rust is actually ok and probably a worth replacement in C/C++ for many applications.

so why dont you just make your own better standard library and forget about the official one

Im a student so its just getting me though the mid year slog. Plus its medicine and not recreational

first for golang

Attached: 1530681638433.png (861x825, 908K)

Perhaps C++, not C.

>Plus its medicine and not recreational
what difference does that make lol

because, retard, taking medication for a mental disorder your dont have isnt exactly safe or advised

This is impressively elegant. F# has some really solid built-ins for concurrency.

let sleepSort n =
async {
do! Async.Sleep n
return n
}

[1..100]
|> List.map sleepSort
|> Async.Parallel
|> Async.RunSynchronously
|> printfn "%A"

Because first of all, I already used to do that in tiny pieces from time to time across applications when I was still too much of a beginner to understand the STL. I still maintain my solutions at that time were superior in their limited applications by virtue of their comparative simplicity. Secondly, now that I actually do understand the standard library, that just sounds like an even bigger pain in the ass than just using it. Which is exactly the kind of logic that keeps other people using it once they know how, the only difference being they have their heads too far up their ass to cope with the basic cognitive dissonance of putting up with something they hate, so they try to rationalize it by pretending they like it. Thirdly, if I cared enough, I'd just jump ship and use a different language. That's more time-efficient than either option. Fourthly and finally, I DID jump ship and use a different language.

drugs are drugs whether you have ADHD or not, only difference is it probably wasnt made in someones bathtub

you can do the same in C#

The only thing Rust is replacing is numale's dick with a wound and their hormones.
Rust is a crippled Ada and C++ with core guidelines already offers more security than one would need without having to constantly wrestle some retarded borrow checker.

var a *int = nil
var b interface{} = a

fmt.Printf("b = %v\n", b) // "b = "
fmt.Println("b == nil:", b == nil) // false

Attached: 1537698616473.jpg (448x342, 59K)

Kekked. I'm also betting it's a fad that'll be gone in some years.

yes it's much easier to just notwritebugs than it is to have them statically checked at compile time

user, I am pretty sure you could just do List.map Async.Sleep.

>Rust is a crippled Ada
Literally nobody but you has even heard of Ada

Never mind, no you can't.

>==24840==WARNING: AddressSanitizer failed to allocate 0xffffffffffffffff bytes
now this is ebin

Most bugs are silly logic errors or oversights that Rust wouldn't cover.

It's fine for replacing C in most applications on an x86. Not replacing as in rewriting everything that works, that is a waste. Replacing as in being a safer way to extend or refactor code as needed to provide better memory guarantees.

The borrow checker is why you use Rust. If it's a problem for the application, then use something else. But in most cases it is helpful for designing memory safe systems which would be incredibly difficult to guarantee without it.