What's the catch?

What's the catch?

Attached: 0911141632.jpg (1263x517, 103K)

Other urls found in this thread:

youtube.com/watch?v=uZgbKrDEzAs
bellard.org/tcc/
etalabs.net/compare_libcs.html
twitter.com/NSFWRedditGif

Synthax seems similar to python.

What does it mean to "compile to C, C++" etc? I thought once something is compiled it is in machine code (assembly of the given CPU)?

Is that a bad thing?

I guess the correct word would be transpile, it translates nim code to c/c++/objective c then compile it automatically.

A literally who language.

>whitespace syntax

Thanks for explaining. In the case that you use classes or something similar which are not included in standard C, would transpiling to C still be an option, or does this force you to use C++?

> I've never worked in a team and I want to show it with a single comment

>Ive never had to sift through other peoples python
Formatting should be done by a tool, not enforced as fucking syntax.
ESPECIALLY because now if you need to indent existing code in another level you have to go through the entire fucking block to double check you didnt just fuck up your logic flow, instead of knowing exactly where you slapped the end bracket

How do you think OOP works user? It basically copies all variables from the superclass into the subclass and adds a pointer to a vtable. You can totally do that in C albeit manually.

Anyway there isn't much use to transpiling to C/C++ in the first place.
First, Even if you want to make it easier to integrate it in an already existing C/C++ project you still need to integrate the transpiler in your build process.
Second, if portability is an issue just write your compiler as a frontend for GCC or LLVM.
third, the transpiled code will be hard to navigate so it isn't all that useful to read it.
fourth, compiling C/C++ is just so god damn slow.

Transpiling to javascript can be useful since it's the only thing that runs in browsers.
Though there is WASM these days.

So, what IS the catch? Is Nim the perfect language?

Not really.

I really like that it can be compiled to multiple languages.

A higher-level universal language that runs on most common basic languages would solve the future of programming issues.

>xkcd-standards.png

Then we need a higher level universal language that can be broken into lower level universal languages that can compile into the most common basic languages.

kek

Depends on how nim wishes to implement it. I'm pretty sure they'll just mimic C++.

Holy fuck you must be a pajeet.
>Formatting should be done by a tool, not enforced as fucking syntax.
Are you really to lazy to press tab? Serioulsy? How can you even read your own code?
>ESPECIALLY because now if you need to indent existing code in another level you have to go through the entire fucking block to double check you didnt just fuck up your logic flow, instead of knowing exactly where you slapped the end bracket
So you're nesting your control flow that deep that you easily lose sight of what it does? Get help.

>calls other people pajeets
>uses tabs
ok pajeet

ok, that shitty example shows something every toy language can do, but since it claims to be a systems programming language, why dont they show how to map a memory page and mark it as executable or something along those lines

>Literally stealing Visual Basic's language
Those autists can't even be even more this retarded jesus christ.

Attached: file.png (859x531, 53K)

>compiling C/C++ is just so god damn slow.
compiling C++ is slow, C is very fast unless you use really aggressive optimizations, what are you talking about?

You know that you can set it to insert spaces in any decent text editor, right? Do you seriously press space 4 times lmao

C is relatively fast compared to C++. It's still shit compared to modern language, except for maybe Rust.
And the biggest cause of that is its include based pseudo-module system.

>still shit compared to modern language
can you give me an example of a compiled language that compiles faster than C? C was/is called "portable assembly" for a reason.

It's shit

youtube.com/watch?v=uZgbKrDEzAs

I Think Go is also compiled (despite being GC).

>was/is called "portable assembly" for a reason.
Because it had a compiler for pretty much every architecture?

so, it's kind of like vala?

file size is another thing that is abhorrent in C++. depending on the platform and compiler, a literal Hello World program in C++ with static linking can take over 1 MB while C is about 10 KB.

C++ is fucking useless for anything other than writing bloatware.

you said
>It's still shit compared to modern language
and you post now some obscure example of a language nobody knows about that MIGHT (I dont know) be MARGINALLY faster to compile than C (using GCC, if you use TCC I'm sure C compiles faster anyway)
>I Think Go is also compiled
go is just a little better than C++, so I doubt its faster than C (I couldnt find any benchmark). And then again, you called it "shit" when it would be a tiny difference even if it were true.
>Because it had a compiler for pretty much every architecture?
no, because it has almost a 1-1 correspondence with asm, therefore making it easy to compile

Attached: 8EbxvYx.png (1209x680, 23K)

>while C is about 10 KB
I agree with you about C++ binary size but this is simply not true, glibc is very big

Attached: hello.png (459x228, 19K)

for reference also, hello world in c++ using std::cout is 2.18MB if compiled statically

>comparing static and dynamically linked binaries

Your graph lacks C.

Anyway, JAI compiles 80Kloc (non trivial program+meta programming) in a single second.

Include files are just inherently slow, there is a hard limit on how fast it can be made in its design. If Go is slow it's because the developers don't know how to design and optimize their compiler for speed.

>no, because it has almost a 1-1 correspondence with asm, therefore making it easy to compile
So it's not about speed. Why are you even bringing this up as an argument?

>Your graph lacks C
I told you I couldnt find a benchmark but my graph shows that C++ beats Go for small programs, and C beats C++ by a lot, so therefore C beats Go.
>Include files are just inherently slow
Its literally just concatenation, not much slower than anything else. And things like #pragma once have been included in compilers to make it faster. AND that is done by the preprocessor, not the compiler
>JAI compiles 80Kloc ... in a single second
GCC compiles 98000 lines/second on a 2.4GHz pentium 4
TCC compiles 859000 lines/second on the same processor
The program is a web browser, so not trivial I guess.
source: bellard.org/tcc/
>Why are you even bringing this up as an argument
umm... if the language is close to assembly there is not much to do when compiling, so you can do it faster

I got 16 KB on my computer. close enough (TM) to my 10 KB off the head estimate. 928 KB for C++.

except I'm not. I'm talking about static linking on both C and C++.

Stop! Hes already dead

>16 KB on my computer.
what OS? libc version? compiler? compilation command?

Except the same program in C would contain a lot more lines of codes because of header files.

>umm... if the language is close to assembly there is not much to do when compiling, so you can do it faster
Generating the instructions isn't the bottleneck.

Lexing/parsing and optimization are the 2 biggest steps

>Anyway there isn't much use to transpiling to C/C++ in the first place.
Transpiling to C is, you're basically extending the language and speeding development without having to deal with the details and verbosity.
>First, Even if you want to make it easier to integrate it in an already existing C/C++ project you still need to integrate the transpiler in your build process.
Nim can use your C libraries with minimal code, but if you already have a huge chuck of your program in C that can't be used as a library rewriting is the only way, the gain will be worth it depending on your case
>third, the transpiled code will be hard to navigate so it isn't all that useful to read it.
The whole point is that you'll never read the transpiled code, it will generate hard to read code and do optimizations, the language itself is what meant to be human readable.
>fourth, compiling C/C++ is just so god damn slow.
Nim caches your files, after the first compilation it'll be significantly faster.

There are alternatives to glibc etalabs.net/compare_libcs.html