Rational Language War Thread

Trying something new.
ITT we debate the merits of different programming languages without the autism.
We're all adults here, or at least most of you pretend to be to avoid being banned. Let's have a proper technical discussion on programming languages.

The two rules are:
-No ad-hominems allowed. As a participant in the thread, you are free and encouraged to ridicule anyone who does this, as long as it is on the basis of their behavior rather than their opinion.
-All arguments must be technical. Shitting on a language's userbase is underage behavior. So are pajeet/onions memes.
Examples of underage behavior:
>ENTERPRISE POO LANGUAGE
>RUST SJW S O Y LANG
>FORTH IS THE WHITE MAN'S LANGUAGE
>Everyone who doesn't use C is a nigger

Attached: pipeline.png (1039x1243, 76K)

Other urls found in this thread:

elbrus2k.wikidot.com/elbrus-compilers
csef.ru/en/nauka-i-obshchestvo/306/sovetskie-korni-proczessora-intel-pentium-4912
translate.google.com/translate?sl=ru&tl=en&u=http://www.mcst.ru/
mcst-volga.ru/en/download-repo/
twitter.com/NSFWRedditImage

>We're all adults here
That's where you're wrong

read the next sentence.

>No ad-homs
Fag

SSA vs CPS?

SSA for most things as CPS-compiled code tends to make lots of non local jumps and fuck up your cache.

CPS but reducing all the administrative redexes (aka ANF) is ok, but better left to functional languages where the presence of call operators requires it.

Anyone has a tips for implementing error recovery in recursive descent parser? Approach to check every parser nesting function call's return value and either throw the error up or try to synchronize isn't ideal. Programming it in language with exceptions might be suggested, but it just cleans this cancellation problem and not an overall design.

Examples that I don't have properly solved:
parser is in states: top level->function->statement->expression
And encounters invalid expression. synchronization point could be semicolon at the end of each statement or significant keyword starting other statement. But parser encounters e.g. FUNCTION keyword which only introduces top level statement.
Should the parser attempt to synchronize on that to top-level statement or just bail completely? Any nice simple implementations of parser with synchronization? Possibly in lang without exceptions?
Maybe I will give up on that and bail on first parser error. That shit is so by miles simpler.

I don't bother with error recovery. I abort with the message "syntax error."

Yeah that's so freaking easy. Currently also print the whole line in question, which is an ok usability for me.
But anything I've managed to come up with just wan't elegant, I wondered if there is some existing solutions that look nice. Both Wirth and Engineering a Compiler mention error recovery but none describe how to actually implement it, only that such possibility exists.

One approach I see a lot is to just discard tokens until you find something you expect. Another is to replace what you found with what you expected, if they look similar enough (eg. comma/semicolon). Another, if there are very few possibilities, is to insert the token you expected.
Obviously you need the appropriate support built into your tokenizer API.

fpbp
this, probably
What said. That said, if your language doesn't typically expect several thousand lines of input, just bail. In particular if you're implementing it in some primitive ooga lang that doesn't have sum types that would allow you to pass back error states in an elegant way.

what is pretty useless and is summary of what books say. my problem is getting the parser into proper state, not finding where to synchronize
I do it in Go currently, only to not have to deal with allocations, polymorphism and the overall design of where/how to store data manually too much. But even in C I would put error/mode flags into the context struct instead of juggling with return types.
I'll probably read through Go's parser for inspiration.

>debate the merits
Surely you know by now that every programming language sucks, and only some have minor advantages? C is unsafe, Rust has horrific syntax, Ruby is slow, etc.

SPARK (the Ada subset)
pros:
>formally defined
>static and dynamic verification
>programming by contract
>good documentation
>GPLv3
>other neat stuff
cons:
>no eco-system because its almost exclusively used in safety-critical systems

Attached: 1549660230063.png (560x760, 323K)

I'm currently programing ROS2 nodes in C++11 for an internship and I kind of like it more than programing the nodes in python. I do however see C++ getting a lot of flak. I myself have not noticed anything bad about programing in C++11, granted the sum of all my code is around 800 lines, which is not much, and my programs are simple. My question is: Is the bad reputation of C++ related to the older versions of C++? Are the newer version of C++ (14, 17) better (, aside from the new features)? Do the newer version actually fix the headaches people often complain about?

in ROS you dont actually encounter the shit that at least I hassle C++fags about, namely namespace mangling and debugging with many levels of inheritance
coming from an low level/embedded systems background i dont see any reason to use C++ over C
trying to make your various I/O implementations generic and reusable between different ECUs is a terrible idea because you end up not reusing shit and having multiple levels of inheritance or write unnecessary amounts of code to do some meme design pattern like decorator or factory method and nothing ends up being simpler
a common interface layer is all you need in that case and its just so much simpler doing it in a structured and procedural manner, generally reduces headaches and errors too because debugging and code analysis is simpler
MISRA compliant C above all
i have also heard that the C++ STL is bad

Attached: 1533104283565.jpg (736x1105, 72K)

>debate
>without autism
>Jow Forums
>adults
kek user nice bait

Can't someone just use some kind of aggressive optimization for functional programming? I mean, if I look at a haskell source code, and I know how to program in assembly well, I could translate it myself and run a really fast program. Why can't compilers do this, do they need AI or something similar?

What's the matter good sir, do you not care for a friendly chat regarding computer interfaces in this exotic eastern digital lounge.

Attached: 15436871012100.jpg (736x991, 86K)

If I am not mistaken, holyC allows you to write assembly instructions right next to your C code.

I'm not talking about writing assembly code, but optimizing any high level language to be as fast as a program written in assembly.

For that I would have to shill the Elbrus processors and their optimizing compiler.
elbrus2k.wikidot.com/elbrus-compilers

The Elbrus CPU has no hardware instruction scheduler or optimizer like in the x86 CPUs. 100% of all optimizations (speculative execution, out of order execution, ...) are done by the optimizing compiler. The end result is a fully optimized assembly code that is executed by the Elbrus CPU. In order execution.

t. Elbrus shill

Attached: Elbrus 2000 summary.png (1118x6281, 764K)

so, pretty much like itanium? people couldn't do it because how difficult it was.

>itanium

The Itanium was a ripoff of Elbrus, just like how the Intel Pentium was.
csef.ru/en/nauka-i-obshchestvo/306/sovetskie-korni-proczessora-intel-pentium-4912

MCST, the company behind the Elbrus CPUs is expanding their production and has some small success stories. They succeeded in creating such a compiler.
translate.google.com/translate?sl=ru&tl=en&u=http://www.mcst.ru/
mcst-volga.ru/en/download-repo/

Attached: The 5th Generation 28nm 8-Core VLIW Elbrus-8C Processor Architecture.png (6164x1439, 2.3M)

upboat XDDDD

hand-written assembly often makes use of optimizations which cannot be implemented in a compiler because applying them to any code would cause a correctness bug.

compiler optimizations are built on logical equivalence rules that are true for any possible code generated by the compiler. The compiler cannot optimize some code if it doesn't know whether those invariants will be satisfied.

Take for example a loop which utilizes two free pointers to write to any buffer(s). The compiler cannot vectorize this loop because the pointers might be the same, causing undefined behavior.

In many cases, compiled code is faster than handwritten code because the handwritten code ignores the nature of the CPU and falls into plenty of pipeline hazards and cache misses.

C and other systems languages also have inline assembly via intrinsic functions or otherwise.

The newer versions don't fix anything, they just add (usually) better alternatives because fixing things would break backwards compatibility.

in my opinion you don't really see the warts in c++ until a little while later, when you either have to debug a very strange heap corruption or off-by-one or unchecked arithmetic overflow bug you didn't introduce, or maintain a medium to large project where you are on the hook if you approve a broken PR.

One example is C++20 concepts. they do technically "fix" unconstrained template metaprogramming, but if there is a flaw in it, C++23 won't fix concepts. They will just add a new feature on top. Rust on the other hand has had trait bounds for the longest time and can fix issues because they aren't encumbered by standards committees.

Language debates are immature by their very nature, your thread is a dumb idea

Hey. I have something for you.

Кpым нe нaш Ukrainian Crimea Protest Пpoтecт The Anti-Rightist Struggle Ущeмлeниe пpaв Human Rights Democratization Дeмoкpaтия Freedom Cвoбoдa Independence Heзaвиcимocть Multi-party system Mнoгoпapтийнaя cиcтeмa Укpaинa Haвaльный Navalny Roskomnadzor Pocкoмнaдзop Этo вaм нe Димoн Suicide Cyицид Hacвaй Beщecтвa Hentai Хeнтaй Adolf Hitler

>copy pasta.
Hahaha, Jokes on you, I live in Belgium.

Attached: VLIW_Elbrus_4_CPU_with_onboard_x86_emulation.jpg (400x659, 108K)

all programming langs suck in some ways but in many cases the benefits outweigh the drawbacks if used in the right case.

for example, C can express certain "unsafe" behaviors that save a lot of overhead. For example, virtual memory translation in Rust would require some strange workarounds and abstractions for safety whereas in C it is a simple arithmetic formula and page/frame table lookup, at the cost of safety.

OTOH, rust can reason about pointer aliasing invariants to optimize more aggressively, as well as generate efficient generic code through static dispatch of monomorphized methods at the cost of binary size.

This means that Rust is fast and safe when you don't need to do unsafe things like talking to the MMU arbitrarily. C is fast when you do need the unsafe things.

engineering is all about tradeoffs. embrace it and take advantage of the right things.

lol it's cool you tried and all but I'm a burgertard so please post some technical content or leave.

Roskomnadzor is technology.

You bring up an interesting point about safety. On the Elbrus CPUs, space is provided on silicon to store metadata for the variables and pointer. Stuff like access rights and type info. When these variables/pointers are used the hardware checks the metadata beforehand to verify if it is used correctly and it is transparent to the program. It is capable of catching out-of-bound exceptions and illegal memory access in plain C. In other words, program safety is handled by the hardware.

Attached: server Elbrus.png (1599x899, 452K)

Check out Grune and Jacob's "Parsing Techniques" error handling chapter. Very thorough.

> Attempts to give parsing advice
> Gives said advice in an ill-formed, ambiguous sentence
Please do not let my retardation discount Grune and Jacobs' excellent work

> engineering is all about tradeoffs. embrace it and take advantage of the right things.
\thread
want to live in a world where computing hasn't been invaded by brainlet fanboys--half of whom are cargo cultists--circlejerking their favorite language

I enjoy being able to shoot myself in the foot with c++. It feel free.
Some of the c++ feature are confusing though, and the error messages that g++ spits out are terrible.

I saw somewhere an android demo that optimizes programs for smoother multithreading. Can't find it any more though.

>maximized terminal window, well over 200 chars wide
>template errors still wrap into multiple lines

S O Y

table of contents look like it could be helpful. thanks, will check