|From:||Gianni Ceccarelli <dakkar [...] thenautilus.net>|
|Date:||Thu, 3 Sep 2015 13:57:29 +0100|
|To:||rakudobug [...] perl.org|
|Subject:||[BUG] INIT-time constants are awkward|
Consider this snippet: constant NOW = DateTime.now; That is a BEGIN-time declaration + initialisation. C<NOW> will contain the time of compilation. On the other hand: my \NOW = DateTime.now; does run-time initialisation, so you get a different time at each run. There does not seem to be a nice way of having a C<constant> with an INIT-time initialiser: constant NOW = INIT DateTime.now; sets C<NOW> to C<Mu>, since a BEGIN time that INIT block has not run. Is there already a working way to do that? Should there be? Thanks.