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

*{""} stringification #11837

Open
p5pRT opened this issue Jan 1, 2012 · 19 comments
Open

*{""} stringification #11837

p5pRT opened this issue Jan 1, 2012 · 19 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 1, 2012

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

Searchable as RT107370$

@p5pRT
Copy link
Author

p5pRT commented Jan 1, 2012

From @cpansprout

*{""} stringifies as *main​::. But *main​:: stringifies as *main​::main​::.

So it doesn’t round-trip properly.

I wonder what is the best way to fix this, or where there is any way that wouldn’t break anything.

This oddity makes Data​::Dumper more complex that it would be otherwise.


Flags​:
  category=core
  severity=low


Site configuration information for perl 5.15.6​:

Configured by sprout at Thu Dec 29 12​:39​:18 PST 2011.

Summary of my perl5 (revision 5 version 15 subversion 6) configuration​:
  Snapshot of​: 7d9189d
  Platform​:
  osname=darwin, osvers=10.5.0, archname=darwin-thread-multi-2level
  uname='darwin pint.local 10.5.0 darwin kernel version 10.5.0​: fri nov 5 23​:20​:39 pdt 2010; root​:xnu-1504.9.17~1release_i386 i386 '
  config_args='-de -Dusedevel -Dmad -Duseithreads'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=undef, use64bitall=undef, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
  optimize='-O3',
  cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.2.1 (Apple Inc. build 5664)', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lutil -lc
  perllibs=-ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector'

Locally applied patches​:
 


@​INC for perl 5.15.6​:
  /usr/local/lib/perl5/site_perl/5.15.6/darwin-thread-multi-2level
  /usr/local/lib/perl5/site_perl/5.15.6
  /usr/local/lib/perl5/5.15.6/darwin-thread-multi-2level
  /usr/local/lib/perl5/5.15.6
  /usr/local/lib/perl5/site_perl
  .


Environment for perl 5.15.6​:
  DYLD_LIBRARY_PATH (unset)
  HOME=/Users/sprout
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/bin​:/bin​:/usr/sbin​:/sbin​:/usr/local/bin​:/usr/X11/bin​:/usr/local/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2012

From @cpansprout

On Sun Jan 01 13​:14​:40 2012, sprout wrote​:

*{""} stringifies as *main​::. But *main​:: stringifies as
*main​::main​::.

So it doesn’t round-trip properly.

I wonder what is the best way to fix this, or where there is any way
that wouldn’t break anything.

This oddity makes Data​::Dumper more complex that it would be
otherwise.

I think the only way to fix this properly is to make *{$foo} equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2012

From [Unknown Contact. See original ticket]

On Sun Jan 01 13​:14​:40 2012, sprout wrote​:

*{""} stringifies as *main​::. But *main​:: stringifies as
*main​::main​::.

So it doesn’t round-trip properly.

I wonder what is the best way to fix this, or where there is any way
that wouldn’t break anything.

This oddity makes Data​::Dumper more complex that it would be
otherwise.

I think the only way to fix this properly is to make *{$foo} equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2012

@cpansprout - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 24, 2012

From @rjbs

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-06-14T20​:56​:39]

I think the only way to fix this properly is to make *{$foo} equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

This doesn't seem nuts to me, and I'm hard pressed to imagine it breaking any
code that is not both cowboy and cavalier... but​:

a) I'd like to hear if there are objections and
b) how about we do a big ol' smoke?

If you make this change, and core doesn't break like crazy, I can even have a
look at using Steffen's smoking machinery. *Somebody* other than him has to
learn to use it!

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2012

From @cpansprout

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-06-
14T20​:56​:39]

I think the only way to fix this properly is to make *{$foo}
equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

This doesn't seem nuts to me, and I'm hard pressed to imagine it
breaking any
code that is not both cowboy and cavalier... but​:

a) I'd like to hear if there are objections and
b) how about we do a big ol' smoke?

If you make this change, and core doesn't break like crazy,

There is one snag​: I can detach the current stash from the symbol table,
in which case its containing *foo​:: glob cannot be found, since the
stash has no reference thereto. I suggesting croaking in that case. Is
it OK to croak when looking up a name outside of strict refs? If so,
what should the error message be, ‘You must be nuts’?

package foo;
undef *foo​::;
*{""}; # what does this do?

Maybe ‘Unable to create glob named ""’. C.f., this old error (gone in
blead)​:

$ perl5.16.0 -e '\&{""}'
Unable to create sub named "" at -e line 1.

I can even
have a
look at using Steffen's smoking machinery. *Somebody* other than him
has to
learn to use it!

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2012

From [Unknown Contact. See original ticket]

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-06-
14T20​:56​:39]

I think the only way to fix this properly is to make *{$foo}
equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

This doesn't seem nuts to me, and I'm hard pressed to imagine it
breaking any
code that is not both cowboy and cavalier... but​:

a) I'd like to hear if there are objections and
b) how about we do a big ol' smoke?

If you make this change, and core doesn't break like crazy,

There is one snag​: I can detach the current stash from the symbol table,
in which case its containing *foo​:: glob cannot be found, since the
stash has no reference thereto. I suggesting croaking in that case. Is
it OK to croak when looking up a name outside of strict refs? If so,
what should the error message be, ‘You must be nuts’?

package foo;
undef *foo​::;
*{""}; # what does this do?

Maybe ‘Unable to create glob named ""’. C.f., this old error (gone in
blead)​:

$ perl5.16.0 -e '\&{""}'
Unable to create sub named "" at -e line 1.

I can even
have a
look at using Steffen's smoking machinery. *Somebody* other than him
has to
learn to use it!

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2012

From @cpansprout

On Fri Jul 27 00​:08​:57 2012, sprout wrote​:

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-06-
14T20​:56​:39]

I think the only way to fix this properly is to make *{$foo}
equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

This doesn't seem nuts to me, and I'm hard pressed to imagine it
breaking any
code that is not both cowboy and cavalier... but​:

a) I'd like to hear if there are objections and
b) how about we do a big ol' smoke?

If you make this change, and core doesn't break like crazy,

There is one snag​: I can detach the current stash from the symbol table,
in which case its containing *foo​:: glob cannot be found, since the
stash has no reference thereto.

Actually, there is another​: I had forgotten when I made the above
proposal that certainly names are forced into the main package.

Currently, the rule is ‘any name not beginning with an idstart character’.

What I proposed above would change it to ‘any name that begins with a
non-idstart character’.

If we don’t change that rule, then the stash-detachment problem goes
away, and %{""} always refers to %​::, resulting in a simpler
implementation and avoiding a potential problem.

And things will still round-trip properly, as \*{*{""}=~s/\*//r} ==
\*{""} will starting returning true.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2012

From [Unknown Contact. See original ticket]

On Fri Jul 27 00​:08​:57 2012, sprout wrote​:

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-06-
14T20​:56​:39]

I think the only way to fix this properly is to make *{$foo}
equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

This doesn't seem nuts to me, and I'm hard pressed to imagine it
breaking any
code that is not both cowboy and cavalier... but​:

a) I'd like to hear if there are objections and
b) how about we do a big ol' smoke?

If you make this change, and core doesn't break like crazy,

There is one snag​: I can detach the current stash from the symbol table,
in which case its containing *foo​:: glob cannot be found, since the
stash has no reference thereto.

Actually, there is another​: I had forgotten when I made the above
proposal that certainly names are forced into the main package.

Currently, the rule is ‘any name not beginning with an idstart character’.

What I proposed above would change it to ‘any name that begins with a
non-idstart character’.

If we don’t change that rule, then the stash-detachment problem goes
away, and %{""} always refers to %​::, resulting in a simpler
implementation and avoiding a potential problem.

And things will still round-trip properly, as \*{*{""}=~s/\*//r} ==
\*{""} will starting returning true.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 4, 2012

From @cpansprout

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-06-
14T20​:56​:39]

I think the only way to fix this properly is to make *{$foo}
equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

This doesn't seem nuts to me, and I'm hard pressed to imagine it
breaking any
code that is not both cowboy and cavalier... but​:

a) I'd like to hear if there are objections and
b) how about we do a big ol' smoke?

If you make this change, and core doesn't break like crazy, I can even
have a
look at using Steffen's smoking machinery. *Somebody* other than him
has to
learn to use it!

May I take you up on your offer? See the sprout/107370 branch.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 4, 2012

From [Unknown Contact. See original ticket]

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-06-
14T20​:56​:39]

I think the only way to fix this properly is to make *{$foo}
equivalent
to *{__PACKAGE__ ."​::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %​:: in the main package, and to
%foo​:: in the foo package.

This doesn't seem nuts to me, and I'm hard pressed to imagine it
breaking any
code that is not both cowboy and cavalier... but​:

a) I'd like to hear if there are objections and
b) how about we do a big ol' smoke?

If you make this change, and core doesn't break like crazy, I can even
have a
look at using Steffen's smoking machinery. *Somebody* other than him
has to
learn to use it!

May I take you up on your offer? See the sprout/107370 branch.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 28, 2012

From @rjbs

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-08-03T22​:56​:30]

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

If you make this change, and core doesn't break like crazy, I can even have
a look at using Steffen's smoking machinery. *Somebody* other than him has
to learn to use it!

May I take you up on your offer? See the sprout/107370 branch.

'fraid not.

I dug up the instructions last week and it was clear that I'm not going to do
it any time too soon. I don't want to leave the question hanging.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Sep 28, 2012

From @cpansprout

On Thu Sep 27 19​:24​:13 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-08-
03T22​:56​:30]

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

If you make this change, and core doesn't break like crazy, I can
even have
a look at using Steffen's smoking machinery. *Somebody* other
than him has
to learn to use it!

May I take you up on your offer? See the sprout/107370 branch.

'fraid not.

I dug up the instructions last week and it was clear that I'm not
going to do
it any time too soon. I don't want to leave the question hanging.

Where are those instructions?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 28, 2012

From [Unknown Contact. See original ticket]

On Thu Sep 27 19​:24​:13 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-08-
03T22​:56​:30]

On Mon Jul 23 19​:44​:36 2012, perl.p5p@​rjbs.manxome.org wrote​:

If you make this change, and core doesn't break like crazy, I can
even have
a look at using Steffen's smoking machinery. *Somebody* other
than him has
to learn to use it!

May I take you up on your offer? See the sprout/107370 branch.

'fraid not.

I dug up the instructions last week and it was clear that I'm not
going to do
it any time too soon. I don't want to leave the question hanging.

Where are those instructions?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 28, 2012

From @rjbs

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-09-28T08​:59​:30]

Where are those instructions?

https://github.com/tsee/cpan_perl_branch_smoke/blob/master/README

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @cpansprout

On Fri Sep 28 07​:03​:35 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-09-
28T08​:59​:30]

Where are those instructions?

https://github.com/tsee/cpan_perl_branch_smoke/blob/master/README

Those are quite involved. So I am going to take the pusillanimous approach.

Steffen, if you are reading this, could you smoke the sprout/107370
branch? :-)

(I do have an ulterior motive. I want more time to experiment with COW
before 5.18.)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From [Unknown Contact. See original ticket]

On Fri Sep 28 07​:03​:35 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-09-
28T08​:59​:30]

Where are those instructions?

https://github.com/tsee/cpan_perl_branch_smoke/blob/master/README

Those are quite involved. So I am going to take the pusillanimous approach.

Steffen, if you are reading this, could you smoke the sprout/107370
branch? :-)

(I do have an ulterior motive. I want more time to experiment with COW
before 5.18.)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @tsee

On 10/02/2012 05​:24 AM, Father Chrysostomos via RT wrote​:

On Fri Sep 28 07​:03​:35 2012, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos via RT <perlbug-comment@​perl.org> [2012-09-
28T08​:59​:30]

Where are those instructions?

https://github.com/tsee/cpan_perl_branch_smoke/blob/master/README

Those are quite involved. So I am going to take the pusillanimous approach.

Steffen, if you are reading this, could you smoke the sprout/107370
branch? :-)

(I do have an ulterior motive. I want more time to experiment with COW
before 5.18.)

Yes, but I'm currently smoking a branch for Karl. Alas, something went
wrong, it used /tmp as the location for temporaries, and the device ran
out of disk space. I'll have to restart Karl's smoke from where it
crashed and burned. Father Chrysostomos​: Can you remind me again when

http​://users.perl5.git.perl.org/~tsee/progress.html
http​://users.perl5.git.perl.org/~tsee/khw-charnames/

indicate that the smoke is complete?

Best regards,
Steffen

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2012

From @tsee

On 10/02/2012 07​:42 AM, Steffen Mueller wrote​:

Yes, but I'm currently smoking a branch for Karl. Alas, something went
wrong, it used /tmp as the location for temporaries, and the device ran
out of disk space. I'll have to restart Karl's smoke from where it
crashed and burned.

Scratch that. Had to restart from scratch as the progress database got
corrupted when the drive filled up. :(

Best regards,
Steffen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants