Announcement
Collapse
No announcement yet.
D Language Front-End Proposed For GCC 8, 800k Lines of Code
Collapse
X
-
-
Originally posted by ldo17 View Post
Python:
Code:operator.add
Code:' +
Code:#'+
Code:+
- Likes 1
Comment
-
Originally posted by peppercats View Post
English not your first language?
That are incredibly verbose and ugly just like the rest of the language. e.g, look at the lambda syntax
Simple lambda that takes two arguments, adds them, and returns the value:
C++:
Code:[](auto a, auto b) { return a + b; }
Code:|a, b| a + b
Code:(a,b) => a + b
Comment
-
-
Originally posted by ldo17 View PostAny option to use automatic reference-counting as a first resort, before falling back to GC? This is how Perl and Python work. This should not be as cache-hostile as insisting on pure GC.
Comment
-
Originally posted by computerquip View Post
Just to clarify, RAII as an idiom doesn't contradict something that's garbage collected. D can use RAII extensively while still being garbage collected.
The language used to not be garbage collector oriented but various functionalities require a garbage collector currently such as string splitting. Yeah, it's fast to allocate but collection is actually pretty slow still (unless they've changed it in the past few years). If it's a real-time application, it's extremely important to remember it's garbage collected since you will fight the GC any time it's collecting unfortunately. If you wish to avoid the GC, there are various rules in which you have to follow and nothing within the compiler or current standard library (phobos still?) to enforce it.
Rust is safer than D in my opinion since it uses language rules to guide the user to correct usages of the allocator rather than doing it pragmatically at runtime (which will still have a chance of memory leakage on abuse anyways). I'm not particularly fond of the Rust syntax honestly but it's currently what I would call the most probable"Next" language because of its approach. I can build a real-time application in Rust without having a few hundred lines of complicated code (possibly more) fighting the GC anytime it collects while I gain semantics that help me from fucking up memory management.
Comment
Comment