If two or more struct initializers have side effects, is the order
that they run defined? Testing with the code below and Rust 0.5 seems
to show that the order of evaluation is the order that the
initialization occurs in (eg swapping the order of len and val in
packet_read causes get_u16 to be call
There is code in the compiler explicitly making sure initializers run
in source order, and I expect it will stay that way. So I guess this
should be mentioned in the documentation as being something you can
rely on.
Best,
Marijn
___
Rust-dev mailing list
Hi,
At today's meeting we had a a discussion about two issues that
intersect, oddly, at a particular point of the syntax. The two issues are:
- Removing the 'static lifetime-name -- currently used to denote
the lifetime of consts -- since the only other use of the word
(static fn ...) i
Bikeshed wh!
The connotations/meanings I associate to these words are:
const => constant, doesn't change / can't be changed
static => statically known (usually "without running it", like in static
types vs. dynamic types, static analysis, etc.)
The desired meaning here seems to be "staticall
I'll speak up in favor of ditching both "const" and "static" for "global".
global foo: int = 1;
global mut bar: int = 1;
&'global baz
(Though not sure exactly what the 'static region is, does that last one
make sense?)
On Tue, Mar 12, 2013 at 3:44 PM, Graydon Hoare wrote:
> Hi,
>
I like 'static' more than 'global' or 'const' for lifetime names, and
I agree that const and static should be unified into a single name.
'static' scares me a bit because of C's use of it in several somewhat
unrelated contexts, and so the name feels a bit polluted in my mind.
But I still like it
History: Static comes from the Greek "statikos" meaning fixed or unmoving.
More History: Static memory or Dynamic memory (same for accesses) has been
used since 1959+
TIP: Avoid overloading at all costs (the bane of other ill conceived
programming languages)
It sounds like everyone is really ju
I think the problem is that three different things are needed, and that these
need different (often pre-existing) keywords (or defaults). I'd suggest:
* Global storage by default for consts
* Promotion to global storage where possible and useful, for const and
immutable values
* A "shared" key