Is enum static?
Dicebot
public at dicebot.lv
Tue Aug 20 16:21:22 PDT 2013
On Tuesday, 20 August 2013 at 22:48:26 UTC, Jonathan M Davis
wrote:
> Static arrays are unsafe in many situations, especially if you
> end up slicing
> them by accident.
But we don't prohibit slicing static arrays. Does not seem
consistent approach. If pointer safety would have been really
important, `scope` definition and implementation would have been
a priority.
> The semantics of static arrays are also very different, since
> they're value types.
But slices of static arrays are still slices. What does it change
in practice?
> Static by default would be a very bad idea IMHO.
> Obviously, static arrays can be desirable, but the programmer
> needs to be
> careful any time that they're used.
How do you expect to convince someone to use D instead of C in
its domain if there no such thing as static array literal? It,
khem, "literally" does not exist.
What bothers me most here is that we have clear @safe and @system
distinction in the language where former is expected to provide
correctness guarantees and latter - C-like power. But in practice
it is @safe and @no-really-safe-but-we-still-care distinction,
with @safe-flavored reasoning severely harming power of common
(or even @system) constructs. I have abandoned any hope to change
this but it keeps frustrating.
More information about the Digitalmars-d-learn
mailing list