/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

ieeexplore.ieee.org.sci-hub.io/abstract/document/1231075/
reddit.com/r/rust/comments/6s7c3d/rrust_hit_100000_uniques_and_1000000_pageviews_in/
samshadwell.me/TrumpScript/
twitter.com/SFWRedditVideos

Dumb cat

getting a job

Smart cat

cat

Oh Shit Got To Poop

/dpt/ - Daily pooinloo thread

After learning several languages and not liking them, I am overcome with the desire to make my own language.
How do I overcome this common malaise?

well, I don't know shit about compilers or machine logic anyway, my gripes are mostly syntactical ones.

Why couldn't early programmers do a sensible thing and leave all the performance features a programming language in the machine code domain, with syntax being a parser/interpreter layer of abstraction for the end programmer? All languages would just compile to intermediate binary code, which then would be optimized and compiled into machine code by a unified compiler.
Then we could even do freaky shit like syntax being defined by the local settings of the IDE, so every programmer could use his own syntax, even within the same project on the same codebase.

I guess you could still make a syntactical wrapper around C or something.

what lightweight laptop would you recommend for some 2d and low poly 3d gamedev?
as long as it can run ide/blender/unity/ue4 that would be great.

Discuss.

(reposting from last thread)
I FUCKING HATE WEB DEV AKA WEBSHIT REEEEEEEEEEEEE

BUT IT'S THE ONLY VIABLE PLATFORM TO ACTUALLY MAKE SHIT ON OTHER THAN MOBILE WHICH IS EVEN GAYER REEEEEEEE

Not enough

>After learning several languages and not liking them
Which languages?

C/C++ and Python, mainly

rude

No one can beat Stroustroup in book thikkness. That's why he's the king.

Common Lisp is the only good language.
Too it's dynamically typed and there's no good implementation.

You can only write so much about something as featureless as C

I've written in C, Python, Pascal, JS, ADA and C#.

As weird as it sounds, I liked Pascal the best, but it has lots of problems of its own. I think the way it internally uses pointers, but abstracts the mess away with function parameter flags is great. But the way it treats arrays and loops is clunky as fuck.
ADA was hell to work with, I think they went too far in a few places with the safety and verbosity. But unique closing blocks for each type of block such as (endif, endfor, etc) is also a great idea.

>unique closing blocks for each type of block such as (endif, endfor, etc)
Worst idea ever

please respond dev-kuns

maybe try agdg?

Can one just fork GCC and modify the parser only as to change the syntax without altering the inner workings of the language itself?

That's a cute kitty

I think Rust made a mistake by abandoning many C/C++ conventions for no reason. Is it hard for people to start using a new syntax? Yes, very hard.

I've been wondering about ways to hide audio messages in innocent music clip videos.
Basically I'd like to merge two audio streams A and B in such a way that a youtube viewer would hear a lightly distorted stream A, and a program could decode it to stream B in realtime. And this method would have to survive youtube's reencoding, so it should be signal methods and not bit based methods.
I have found some papers which I find relevant.
A WAVELET DOMAIN LSB INSERTION ALGORITHM FOR HIGH
CAPACITY AUDIO STEGANOGRAPHY
ieeexplore.ieee.org.sci-hub.io/abstract/document/1231075/
Any particular ideas on this?

GCC can compile many languages and has many targets.
You should see how to add new GCC frontend, might not even require modyfing GCC itself.

These are all Algol-type languages. Try ML-like (Ocaml or F#), Haskell and Lisp (Racket or CL).

...

damn... i just did and they sent me to g

you can't do anything with GCC's source except for compiling it

Started learning Python today as my first scripting language. This is surprisingly fun and rewarding.

It is not very hard to learn a new syntax. You're just retarded.

Its not off the shelf, its a cheap Chinese knockoff
What would you suggest learning with? I have a lot of time soon

Trying to get the hang of it before starting a programming course in September.

Today I realized that in C# 'Console' is the same class as any other and WriteLine is a method like any other.

Believe it or not, it makes things (i.e. understanding the concept of classes and methods) much clearer for me.

cool

It's possible, you can modify the parser so that *your* concrete syntax would generate the same AST as the correspondent standard C's syntax. After that you can just reuse all the immediate code generations and backends of GCC.
But of course it's not practical especially if you just have silly gripes with an ancient language's syntactic quirks. You'd have an easier time defining new CPP's macros to implement your own """syntax""". That was how Stroustroup originally implemented C++ and that was why C++ started out shit and only gets worse as time goes by, because its originator is a fucking hack.

Yeah, but keep in mind that you're typically using static methods on Console, like Write, which allows you to call a method that belongs to a class without creating an instance of that class to use. Those are going to work a little differently, and be designed differently, than non-static methods made to work on a unique instance.

Rust's syntax borrows a lot from ML's family, so yeah it's easy for me. But if you can't even handle something as trivial as the syntax differences how could you handle its completely different type system? Just man the fuck up my user-kun.

I rather have problems with the user interface design that the syntax encapsulates. It seems most syntax is the way it is to appease the parser and the compiler, not to appease the programmer or achieve some kind of usability goals.

It's just poor interface design and I don't like it aesthetically. My idea is that the syntax should be a concise and internally consistent design language for controlling the compiler behavior.

perhaps he's fine with it but is worried that these choices will restrict its popularity

It's easier for the parser though, as silly as it sounds the ``dangling ifs'' was an actual parser implementing problem.
Nah, beside the lexer, the parser is just the tiniest and most trivial part for pretty much every compiler (even toy ones) in existence. C's syntax being this way is just solely of historical reason.

>controlling the compiler behavior
You don't control the compiler behavior with syntax though. Most of the code generation, static analysis, IR rearrangement and optimization, backend code generator's interfacing and linking have nothing to do with the language's syntax.
Syntax is not anything complicated, it's just that once you defined a concrete syntax it's really hard to make posthoc changes. That's why languages like Scheme and Lisp are so valuable.

Question is, why is something so superficial also so tightly embedded into the language that it can't just be changed on the fly.
Why isn't there an intermediate parser output or something.
Damn, I'm so smart with my hindsight.

>Why isn't there an intermediate parser output or something
There are, they are call abstract syntax tree, IR code and backend code. The problem is there are already a fuckload of softwares written in the old ``surface'' syntax that wouldn't build anymore if you just nonchalantly changed it.
In languages where you can directly access and modify ASTs like the Lisp languages, you can change the syntax to suit your taste, especially if you have reader macros like in Common Lisp.

I'm skeptical that Rust will be the next big thing. So like others I think I won't make that huge time investment. It would be easier if the syntax was C/C++/Java like.

stay left behind then punk

Hol up, what if you like, build your codebase into the intermediate language and store it as that, with IDEs or whatever interface just decoding it into your syntax of choice?
Damm, I'm so smartta

inheratance is a worse form of composition

A lot of bigshot compiler implementations of other languages reuse GCC's and LLVM's code generation as their backend, so yeah alternatively you could make your own language and do just that.
It's called decompilation and if you have ever looked at a decompiler's output, you'll realize you aren't that smart after all.
To be honest I feel like I'm talking with a clueless sophomore with too much confident in himself or something. Just learn that damn undergrad compiler course before trying to reinventing the wheel for the 2^64th time ``please''.

>clueless sophomore with too much confident in himself
Unironically the correct description of 90% of /dpt/fags

lmao I bet decompilation is just a problem of implementation, especially from an intermediate binary stage
it's just that nobody was smart enough to do it right
before me

my iq is one of the hifhest

Ok.

reddit.com/r/rust/comments/6s7c3d/rrust_hit_100000_uniques_and_1000000_pageviews_in/
:^)

I have just found out there existed sanic hegehog videos games on android, and I couldn't resist looking inside since android reverse engineering is easy and fun.
So it's implemented in a x86 library on top of openGL ES, symbols are present, and java decompilation gives signatures of JNI entry points.
So I'm sure a sufficiently dedicated autist could dlopen that library and wrap that into a Linux desktop game without great difficulty.

What is the Klossiest programming language/ framework?

Probably Ruby!

I just saw her in a youtube ad selling some premade webshit app.
I think she gave up programming because it's too hard.

Must be this samshadwell.me/TrumpScript/

>I think she gave up programming
she never started. its just propaganda.

Read SCIP, if you find scheme boring you need another profession.

Kut her some fucking slack, she's not even 25 yet.

Try Rust!
>inb4 HURR DURR SJW
It's open source, no SJWs control it.

I've misjudged Python like so many others

in what way?

>It's open source
Sup Forums should fork it and make it not shit then
Call it Sup Forumsust

Let's call it Sup Forumsarbage then, for the lack of a garbage collector means its eternal reign as the shittiest language in existence!

She is 25 and some days.

Hello Christian.

I am garbage collector pilled now.

Trying to manually manage your memory is like trying to manually optimize your code. Why bother if the compiler/GC is going to do it a million times more efficient than you? Wasted effort.

Use Rust and have the compiler do it for you at compile time without any overhead!

nah jk

>make it not shit
Why are you on Sup Forums when you lack the reading comprehension of a 12 year old
Underaged b&

>make it not shit
Because it's impossible for Sup Forums to make anything equally or less shitty.

>i missed karlie's birthday

I really fucked up, Sup Forums.

based

Is there a way to automatically organize source files in VS?
Like when my function definitions are not in the same order as the header declarations?
No spectrum comments.

The fruits of liberal faggotry.

Why is it bad to sizeof() a char?

Keep at it

it's always 1, i do it anyway because it's more readable

Good for you user, have fun with snek

Is guaranteed to be 1, so it's pointless. It just clutters up code.

Trying to write some I2C bare-metal code for an STM32 platform. I'm really considering switching to an OS, does anyone know an extra lightweight one who's been ported to Cortex-M ?

Why? Making a special condition check for char will clutter up your code

Day 1 of self-study, burned through 2 chapters of Matthes' book on Python. At page 70 of 562. Going to take a break for a while, then get at least one more chapter in today. This is going swimmingly. If I keep up this solid pace, I'll be done before the month is over!

Thanks for the well-wishes!

>special condition check for char
What special condition?
It's almost always blatantly obvious that what you're allocating is a string, even without the sizeof(char).
Typical uses would be
// Functionally equivalent to strdup
char *dup = malloc(strlen(str) + 1);
strcpy(dup, str);
// Functionally equivalent to asprintf
int len = snprintf(NULL, 0, "%d%d%d", a, b, c);
char *str = malloc(len + 1);
sprintf(str, "%d%d%d", a, b, c);
A sizeof(char) doesn't add anything meaningful.

>Then we could even do freaky shit like syntax being defined by the local settings of the IDE, so every programmer could use his own syntax, even within the same project on the same codebase.

Sounds cool at first, but do you trust pajeet to come up with his own syntax that makes sense to others? It would make collaborative programming an absolute clusterfuck.

Maybe check out an X or T-series Thinkpad. As long as you get an i3 or higher, it should do the job.

You picked a good choice, user.

The banner on her coding camp's website has a Ruby extension. Good guess.

>Sounds cool at first, but do you trust pajeet to come up with his own syntax that makes sense to others? It would make collaborative programming an absolute clusterfuck.
Well, it wouldn't matter, since the actual source code would be in binary, displaying it in a given syntax would just be a local user decompilation stage. You just open the binary source and your IDE translates it to the syntax of your choice.

LLVM :)

LLVM has the Fatal Flaw of not being invented by me.

Just fork LLVM then? That's the point of FOSS, just take credit for it.

>What special condition?
For getting the byte size of an arbitrary variable, which is the whole point of sizeof. The whole point is that sizeof works with any object. If I'm writing a function to validate an arbitrary variable, I'm not going to write a break case just for a char type.

So the Git repo or whatever source control would have a preset syntax too, but could then be decompiled when it's cloned to the user's local? Might be an interesting way to add my own syntactic sugar to the language. Or could a Java programmer use this to make C# "look like" Java, assuming someone takes the time to make a syntax tree for them.

I have to use some baby IDE called BlueJ for a dumb intro to programming course.
Now I not only have to program in Java, but I have to program clicking on stuff.
It's so fucking braindead.

See no reason the Git repo wouldn't contain the intermediate binaries, with each user just choosing a pre-set or user-defined display syntax like one would choose a color scheme on a website.

>size of an arbitrary variable
Keep doing that then. You're taking this argument out of proportion. It's not a case of "Don't ever do this, it's completely terrible and can break everything", it's just a preferred style thing because it could be pointless. If a sizeof(char) or something gets generated by a macro or whatever, it's not anything to even be bothered about.
I think taking the size of a variable directly is always appropriate (and preferable to taking the size of a type directly), even if the variable is a char. It allows you to change things later, like changing the string a wide string or something easily later.

The argument is really against cases where you're allocating a string or "raw" data in terms of bytes and putting a sizeof(char) in the malloc expression.

Or if there's a problem of browser bloat or PC performance, store several decompiled versions in most common syntaxes or whatever.

Wait, this is getting dumb.

Try Go or Ruby!

What's a good IDE for learning C? I don't want it to autocomplete, just to run stuff without having to go into terminal/commandline and use gcc
I already know Java and Python, so it's more specifically learning C and lower level language material than learning to program, to be clear.