Re:Ali Cehreli Introduces Dlang at Northeastern U
by synergy20 on Tuesday October 11, 2022 @04:49PM
(#33169054)
makes sense, thanks!
Re:Ali Cehreli Introduces Dlang at Northeastern U
by no_wizard on Tuesday October 11, 2022 @05:46PM
(#33169654)
Is there a way to enable safe "D" by default, rather than using the `@safe` (what looks to be) modifier?
Re:Ali Cehreli Introduces Dlang at Northeastern U
by gavinray on Tuesday October 11, 2022 @06:28PM
(#33170082)
D-lang attributes can be used like a label, so for example you can put at the top of your file:
@safe nogc:
auto myFunc() { // do stuff }
struct Blah {}
Whatever attributes you use apply to all code in the lexical scope below the colon.It's useful for structs/classes
struct MyThing {
auto unsafeFunc() {}
@safe:
auto safeFunc1() {}
}
Re:Ali Cehreli Introduces Dlang at Northeastern U
by acehreli on Tuesday October 11, 2022 @05:53PM
(#33169712)
No. We had a very long discussion about safe-by-default on the forums but failed to reach a consensus.
As I understand it, for safe-by-default to work, either all C libraries would have @trusted D bindings written, or all of them would have to be assumed to be @trusted. Most of the community wanted explicit @trusted annotations, Walter and others favored assuming them to be @trusted (or was it assumed @safe?) was the way to go. So, no safe-by-default at this time. :/
I don't know Zig yet.
I had an opinion long time ago that nobody should use C anymore; I would suggest C++ at least because it has constructors and templates. D's [Better C](https://dlang.org/spec/betterc.html) would be my go-to at this time.
C++ is getting better but it's still very difficult to get right: It depends mainly on programmer attention e.g. to follow 400+ [guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines).
Rust is "different" but it has the borrow checker as a safety tool. D's [live functions](https://dlang.org/spec/ob.html) and other [memory safety](https://dlang.org/blog/2022/10/08/dip1000-memory-safety-in-a...) features are closing the gap there.
> major selling point
I am copying slide 59 here: D provides competitive advantage by helping happy programmers produce correct programs pragmatically.
Slide 8 lists what D does not have, which can explain why D has not gained popularity that it deserves. For example, nobody can sell D as "Google's language" or "Apple's language".