[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
What language is the best substitute for C++? >Rust >D
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 37
Thread images: 2
What language is the best substitute for C++?

>Rust
>D

I want something as powerful as C++ without having to learn a bunch of shit.

>I'm coming from Java
>>
>>54823767
C
>>
C++.
It's not hard if you use a sane framework like qt.
>>
>>54823767
what is the purpouse? Web service? Some embedded shit?
>>
Take a look at golang. It's not completely OO but you can work with it. It's currently a meme language but it's hella popular and it is taking off like crazy. Syntax is similar to the C/Java paradigm
>>
>>54823767

If you follow the Rust way you _will_ learn new things or die cursing the borrow checker.
The path is narrow, but it will lead you to destination.
>>
>>54823825
Go's syntax is Oberon-2 (descendant of Pascal) with some of the more verbose keywords shortened. The only thing C like about it is the curly braces.

Programming in it *feels* like Oberon too, very unlike C or C++ which probably explains why it's gotten little traction in those camps.
>>
>>54823767
>Rust
Only if you like SJW's. Rust is cancer incarnate.
>>
>>54823767
>without having to learn a bunch of shit
Only C/C++ then
>>
>>54823825
>taking off like crazy
Thats what I thought when I wrote a bunch of shit on it 6 years ago.
>>
>>54823767
D has a required garbage collector, so it's not comparable to C++.

You can disable it with a `nogc` annotation but then it infects everything like the `pure` annotation does, and then you can't use any library ever made, and can't use most parts othe stdlib.

I'm personally betting on Rust.
>>
>>54824802
There may be some SJWs, but most Rust people just ignore them.

Personally I had an argument against an SJW retard because another guy clearly from 4chan used the word "fag".

So the guy started arguing with the SJW, I started bringing linguistical arguments and inapplicability of the code of conduct in the channel in which the discussion was taking place, because the SJW had requested the guy to be banned.

Long story short, he was banned because he was nobody, I wasn't because I made and maintain a dozen crates.

Just don't go there to stir shit up, or make a name for yourself before stirring shit up and you'll be fine.

From a PLT point of view Rust is glorious.
>>
>>54825906
I need dem logs.
>>
>>54826142
They're publically logged I think, but I'm not going to disclose who I am on here, if you want to search for it you can find it, good luck.
>>
>>54826202
https://botbot.me/mozilla/rust-gamedev/2016-04-03/?msg=63428185&page=3

pretty boring desu
>>
>>54824802
Golang is SJW infested too.
>>
>>54826202
>>54826350
And it's not like you're not a known /g/ shitposter.
>>
>>54826350
Of course, what did you expect?

>>54826371
That's totally not me!
>>
File: BaseD.jpg (846 KB, 1580x3422) Image search: [Google]
BaseD.jpg
846 KB, 1580x3422
>>54823767
>What language is the best substitute for C++
>I'm coming from Java

D has full Java-style OOP, so you may want to start with that and move on to Rust if you find that you don't like D.

Also depends on whether you want an SJW-cuck language (Rust) or an anti-SJW language (D).
>>
>>54823767

Python running on PyPy
>>
>>54826574
Good stuff.
>>
>>54823767
>What language is the best substitute for C++?
C++11.
>>
>>54826574
>garbage collection
>>
>>54826652
>Not C++17
>>
>>54826762
>It can be disabled, there are many other techniques that use stack allocation or allocators instead, and you can annotate your code to statically ensure that no GC allocations will happen.
>>
>>54826782
Does it have good type inference?
>>
>I want something powerful
>without learning
Go home pajeet
>>
>>54826782
>thus making most libraries useless
>>
>>54823767
Don't worry. I'm developing a new language right now that will solve your problems. It'll be ready in a year.
>>
>>54826941

The saviour has spoken!!!
>>
>>54826871
Depends on what you mean by good. It's not Haskell-level where you don't have to write any types at all and the compiler magically figures it out.

Here is an implementation of the Shunting Yard algorithm:
https://dpaste.dzfl.pl/76f8e6cd207f

Project Euler Longest Collatz Sequence problem:
https://dpaste.dzfl.pl/6e43091ff55c

A little more "functional" style, finding the sum of the digits in 2^1000:
https://dpaste.dzfl.pl/85d691d8c651

I don't claim to be a good programmer. This is just an idea of what D looks like in practice.
>>
>>54827042
Actually I lied. It will only solve my problems.
>>
>>54827052
C-style languages really need to die. Just look at that fucking ugly way to declare a tuple.
>>
>>54827091
It's specific to D, not because it's a C-based language. The community for a long time has wanted built-in tuples to be beautiful and usable, like in Python:

(int, double) getPair()
{
return (0, 0.0);
}

(i, d) = getPair();

assert(i == 0 && d == 0.0);


There was a proposal a few years ago to add syntax like this but it has been in limbo for a long time and nobody's had the desire to try and push it through.
>>
>>54827132
Is that so. I can only imagine how the parser for that must look like. A parser for a Rust-like language is very easy to write with at most one token lookahead necessary.
>>
>>54827147
D's grammar is context-free but I believe it requires unlimited lookahead due to constructs like:

auto array = [0, 1, 2];
auto arraySlice = array[1..2]; //Slice syntax requires unlimited lookahead


But I'm not very familiar with the specifics. It's more or less similar to Rust's syntax with a few key differences.
>>
>>54827176
One of the differences is the proposed syntax for tuple destructuring. Since it's not clear if `(` starts simply an expression in parenthesis or a tuple pattern you already need infinite lookahead when a line starts with `(`.
Thread replies: 37
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.