Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

our \NOW = DateTime.now; #4504

Open
p6rt opened this issue Sep 3, 2015 · 4 comments
Open

our \NOW = DateTime.now; #4504

p6rt opened this issue Sep 3, 2015 · 4 comments
Labels
NYI Features not yet implemented

Comments

@p6rt
Copy link

p6rt commented Sep 3, 2015

Migrated from rt.perl.org#125975 (status was 'open')

Searchable as RT125975$

@p6rt
Copy link
Author

p6rt commented Sep 3, 2015

From @dakkar

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.

@p6rt
Copy link
Author

p6rt commented Sep 4, 2015

From @jnthn

On Thu Sep 03 05​:57​:58 2015, dakkar wrote​:

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.

Correct, and there's no sensible way to make that work.

Is there already a working way to do that? Should there be?

Yes, an "our" scoped variable should have its initializer run at our time​:

our \NOW = DateTime.now;

That's not implemented yet, so re-purposing this ticket for implementing that. :-)

@p6rt
Copy link
Author

p6rt commented Sep 4, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 1, 2017

From @AlexDaniel

Still NYI (2017.11, HEAD(5929887))

On 2015-09-04 08​:25​:24, jnthn@​jnthn.net wrote​:

On Thu Sep 03 05​:57​:58 2015, dakkar wrote​:

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.

Correct, and there's no sensible way to make that work.

Is there already a working way to do that? Should there be?

Yes, an "our" scoped variable should have its initializer run at our
time​:

our \NOW = DateTime.now;

That's not implemented yet, so re-purposing this ticket for
implementing that. :-)

@p6rt p6rt added the NYI Features not yet implemented label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NYI Features not yet implemented
Projects
None yet
Development

No branches or pull requests

1 participant