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

$init-time-num breaks introspection #4853

Open
p6rt opened this issue Dec 13, 2015 · 4 comments
Open

$init-time-num breaks introspection #4853

p6rt opened this issue Dec 13, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 13, 2015

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

Searchable as RT126889$

@p6rt
Copy link
Author

p6rt commented Dec 13, 2015

From zefram@fysh.org

$ perl6 -e 'say $init-time-num; say CORE​::<$init-time-num>'
1449983501.60682
Lexical with name '$init-time-num' has a different type in this frame
  in block <unit> at -e​:1

It's the retrieval of the value from the symbol table that triggers
the error. This is a hazard for introspective code.

-zefram

@p6rt
Copy link
Author

p6rt commented Dec 13, 2015

From @lizmat

On 13 Dec 2015, at 05​:15, Zefram (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Zefram
# Please include the string​: [perl #​126889]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126889 >

$ perl6 -e 'say $init-time-num; say CORE​::<$init-time-num>'
1449983501.60682
Lexical with name '$init-time-num' has a different type in this frame
in block <unit> at -e​:1

It's the retrieval of the value from the symbol table that triggers
the error. This is a hazard for introspective code.

This actually applies to any native on any PseudoStash​:

$ 6 'my int $a = 42; say MY​::<$a>'
Lexical with name '$a' has a different type in this frame
  in block <unit> at -e​:1

Also​: $init-time-num is an unintended leak of a variable to allow for lazy population of $*INITTIME. I’ve now removed that leak by not populating $*INITTIME lazily anymore. This adds 2 milliseconds to bare startup.

FWIW, the bug seems to be in the underlying nqp​::atkey​:

$ 6 'use nqp; my int $a = 42; my $m := nqp​::getattr(MY​::,Map,q/$!storage/); say nqp​::atkey($m,q/$a/)'
Lexical with name '$a' has a different type in this frame
  in block <unit> at -e​:1

$ 6 'use nqp; my Int $a = 42; my $m := nqp​::getattr(MY​::,Map,q/$!storage/); say nqp​::atkey($m,q/$a/)’
42

Liz

@p6rt
Copy link
Author

p6rt commented Dec 13, 2015

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

@p6rt
Copy link
Author

p6rt commented Dec 13, 2015

From @lizmat

On 13 Dec 2015, at 10​:44, Elizabeth Mattijsen <liz@​dijkmat.nl> wrote​:

On 13 Dec 2015, at 05​:15, Zefram (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Zefram
# Please include the string​: [perl #​126889]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126889 >

$ perl6 -e 'say $init-time-num; say CORE​::<$init-time-num>'
1449983501.60682
Lexical with name '$init-time-num' has a different type in this frame
in block <unit> at -e​:1

It's the retrieval of the value from the symbol table that triggers
the error. This is a hazard for introspective code.

This actually applies to any native on any PseudoStash​:

$ 6 'my int $a = 42; say MY​::<$a>'
Lexical with name '$a' has a different type in this frame
in block <unit> at -e​:1

Also​: $init-time-num is an unintended leak of a variable to allow for lazy population of $*INITTIME. I’ve now removed that leak by not populating $*INITTIME lazily anymore. This adds 2 milliseconds to bare startup.

In 4bc8f3358029866a0854d266 I actually found a way to keep the lazy init *and* remove the leak.

Liz

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

No branches or pull requests

1 participant