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

Better overload APIs needed #12129

Open
p5pRT opened this issue May 23, 2012 · 12 comments
Open

Better overload APIs needed #12129

p5pRT opened this issue May 23, 2012 · 12 comments

Comments

@p5pRT
Copy link

p5pRT commented May 23, 2012

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

Searchable as RT113050$

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @andk

git bisect


commit 50853fa
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Sat May 19 23​:46​:04 2012 -0700

  Make overloaded classes inherit fallback

sample fail report


http​://www.cpantesters.org/cpan/report/7d4efbec-a3ba-11e1-b045-c602f4b14d39

perl -V


Summary of my perl5 (revision 5 version 17 subversion 0) configuration​:
  Commit id​: 50853fa
  Platform​:
  osname=linux, osvers=3.2.0-2-amd64, archname=x86_64-linux-thread-multi
  uname='linux k83 3.2.0-2-amd64 #1 smp mon apr 30 05​:20​:23 utc 2012 x86_64 gnulinux '
  config_args='-Dprefix=/home/src/perl/repoperls/installed-perls/perl/v5.16.0-87-g50853fa/9980 -Dmyhostname=k83 -Dinstallusrbinperl=n -Uversiononly -Dusedevel -des -Ui_db -Duseithreads -Uuselongdouble -DDEBUGGING=-g'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2 -g',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.6.3', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
  libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  libc=, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.13'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
  PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
  PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_USE_DEVEL
  USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS
  USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
  USE_PERL_ATOF USE_REENTRANT_API
  Built under linux
  Compiled at May 23 2012 06​:24​:31
  @​INC​:
  /home/src/perl/repoperls/installed-perls/perl/v5.16.0-87-g50853fa/9980/lib/site_perl/5.17.0/x86_64-linux-thread-multi
  /home/src/perl/repoperls/installed-perls/perl/v5.16.0-87-g50853fa/9980/lib/site_perl/5.17.0
  /home/src/perl/repoperls/installed-perls/perl/v5.16.0-87-g50853fa/9980/lib/5.17.0/x86_64-linux-thread-multi
  /home/src/perl/repoperls/installed-perls/perl/v5.16.0-87-g50853fa/9980/lib/5.17.0
  .

--
andreas

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @cpansprout

Already? :-)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

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

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @cpansprout

On Tue May 22 22​:48​:22 2012, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

git bisect
----------
commit 50853fa
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Sat May 19 23​:46​:04 2012 -0700

Make overloaded classes inherit fallback

sample fail report
------------------
http​://www.cpantesters.org/cpan/report/7d4efbec-a3ba-11e1-b045-
c602f4b14d39

Well, it turns out that most* of CPAN, not just Mouse, is breaking
overload.pm’s encapsulation, so I’ll have to work around it.

I also forgot to change ExtUtils​::ParseXS to account.

I’ve just noticed that, whereas overload.pm says​:

  In the current
  implementation, the value of C<fallback> in the first overloaded
  ancestor is used, but this is accidental and subject to change.

perlxs.pod says​:

  If you do not set any FALLBACK value when using OVERLOAD,
  it defaults to UNDEF.

So, what is described as an implementation artefact (something to be
fixed) in overload.pm is documented as a feature in perlxs.

So, should ExtUtils​::ParseXS follow suit and allow fallback to be
inherited, or should it retain its documented behaviour?

I would prefer the former, but I could implement it either way. This
will affect how I fix this.

* Exaggeration.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @cpansprout

On Wed May 23 00​:01​:46 2012, sprout wrote​:

On Tue May 22 22​:48​:22 2012, andreas.koenig.7os6VVqR@​franz.ak.mind.de
wrote​:

git bisect
----------
commit 50853fa
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Sat May 19 23​:46​:04 2012 -0700

Make overloaded classes inherit fallback

sample fail report
------------------
http​://www.cpantesters.org/cpan/report/7d4efbec-a3ba-11e1-b045-
c602f4b14d39

Well, it turns out that most* of CPAN, not just Mouse, is breaking
overload.pm’s encapsulation, so I’ll have to work around it.

I’ve just fixed it in commit 3866ea3, but I don’t particularly like it.
The result of having parts of overload.pm and ParseXS.pm copied and
pasted all over the place is that perl can’t be as fast as it would be
otherwise. I’m wondering whether we should provide a C function for
registering overloading and force CPAN to switch (by reverting 3866ea3).

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @cpansprout

On Wed May 23 00​:01​:46 2012, sprout wrote​:

I’ve just noticed that, whereas overload.pm says​:

In the current
implementation\, the value of C\<fallback> in the first overloaded
ancestor is used\, but this is accidental and subject to change\.

perlxs.pod says​:

If you do not set any FALLBACK value when using OVERLOAD\,
it defaults to UNDEF\.

So, what is described as an implementation artefact (something to be
fixed) in overload.pm is documented as a feature in perlxs.

So, should ExtUtils​::ParseXS follow suit and allow fallback to be
inherited, or should it retain its documented behaviour?

I would prefer the former, but I could implement it either way. This
will affect how I fix this.

Actually, it didn’t affect the fix, but the question remains.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @rgarcia

On 23 May 2012 15​:03, Father Chrysostomos via RT
<perlbug-followup@​perl.org> wrote​:

Well, it turns out that most* of CPAN, not just Mouse, is breaking
overload.pm’s encapsulation, so I’ll have to work around it.

I’ve just fixed it in commit 3866ea3, but I don’t particularly like it.
 The result of having parts of overload.pm and ParseXS.pm copied and
pasted all over the place is that perl can’t be as fast as it would be
otherwise.  I’m wondering whether we should provide a C function for
registering overloading and force CPAN to switch (by reverting 3866ea3).

2 functions probably​: for registering, and for checking if there's
overloading in place (if I'm following you), like the Overloaded and
Method functions.

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @ikegami

On Wed, May 23, 2012 at 3​:01 AM, Father Chrysostomos via RT <
perlbug-followup@​perl.org> wrote​:

I’ve just noticed that, whereas overload.pm says​:

In the current
implementation, the value of C<fallback> in the first overloaded
ancestor is used, but this is accidental and subject to change.

perlxs.pod says​:

If you do not set any FALLBACK value when using OVERLOAD,
it defaults to UNDEF.

So, what is described as an implementation artefact (something to be
fixed) in overload.pm is documented as a feature in perlxs.

This is a false dichotomy. Set by the base class is still set.

@p5pRT
Copy link
Author

p5pRT commented May 23, 2012

From @cpansprout

On Wed May 23 06​:26​:40 2012, rgs@​consttype.org wrote​:

On 23 May 2012 15​:03, Father Chrysostomos via RT
<perlbug-followup@​perl.org> wrote​:

Well, it turns out that most* of CPAN, not just Mouse, is breaking
overload.pm’s encapsulation, so I’ll have to work around it.

I’ve just fixed it in commit 3866ea3, but I don’t particularly like it.
 The result of having parts of overload.pm and ParseXS.pm copied and
pasted all over the place is that perl can’t be as fast as it would be
otherwise.  I’m wondering whether we should provide a C function for
registering overloading and force CPAN to switch (by reverting 3866ea3).

Just to put this in perspective, these are affected​:

PP​:
Class-C3-0.23
Class​::C3 as included by​:
- Catalyst-Controller-Resources-0.08
- Lingua-EO-Orthography-0.03
- DBICx-Modeler-Generator-0.02
- MooseX-Types-Locale-Country-0.04
EntityModel​::Support​::Perl in EntityModel-0.014
AnyEvent-6.11
Lvalue-0.21
POEx​::Role​::SessionInstantiation​::Meta​::Session​::Magic in
POEx-Role-SessionInstantiation-1.102610
Tak​::STDIONode in Tak-0.001001
Pixie​::Proxy in Pixie-2.06

XS​:
version-0.95, but that is kept well in synch with core
ExtUtils​::ParseXS as included by​:
- Memcached-libmemcached (test suite)
Linux-CDROM-0.02
Mouse-0.97
Text-Xslate-1.5007
libapreq2-2.13

2 functions probably​: for registering, and for checking if there's
overloading in place (if I'm following you), like the Overloaded and
Method functions.

I was only thinking in terms of what CPAN modules already do. All the
XS ones just register overloading. Most of the pure-Perl ones do the
same; some inspect the stash instead of calling overload'Overloaded;
some inspect the stash to find out the fallback value, for which we
currently have no interface. (I’ve just realised that I made
overload'Method("fallback") return the fallback value in 50853fa, and
then stopped that from working in 3866ea3.)

In any case, the registration interface could be​:

hv_amagic_register(HV *stash, const char *op, SV *value)

with a NULL op for registering and a NULL value for the ‘no overload’
equivalent.

I’m suggesting amagic rather than overload in the name, because there
are already two API functions containing it. But maybe overload would
be better.

For enquiry, which is best?

hv_amagic(HV *stash, const char *op)
hv_amagic_get(...)
hv_amagic_method(...)

Maybe we should use get and set, for parallelism.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2013

From @jkeenan

On Wed May 23 13​:41​:26 2012, sprout wrote​:

On Wed May 23 06​:26​:40 2012, rgs@​consttype.org wrote​:

On 23 May 2012 15​:03, Father Chrysostomos via RT
<perlbug-followup@​perl.org> wrote​:

Well, it turns out that most* of CPAN, not just Mouse, is breaking
overload.pm’s encapsulation, so I’ll have to work around it.

I’ve just fixed it in commit 3866ea3, but I don’t particularly
like it.
 The result of having parts of overload.pm and ParseXS.pm copied and
pasted all over the place is that perl can’t be as fast as it would be
otherwise.  I’m wondering whether we should provide a C function for
registering overloading and force CPAN to switch (by reverting
3866ea3).

Just to put this in perspective, these are affected​:

PP​:
Class-C3-0.23
Class​::C3 as included by​:
- Catalyst-Controller-Resources-0.08
- Lingua-EO-Orthography-0.03
- DBICx-Modeler-Generator-0.02
- MooseX-Types-Locale-Country-0.04
EntityModel​::Support​::Perl in EntityModel-0.014
AnyEvent-6.11
Lvalue-0.21
POEx​::Role​::SessionInstantiation​::Meta​::Session​::Magic in
POEx-Role-SessionInstantiation-1.102610
Tak​::STDIONode in Tak-0.001001
Pixie​::Proxy in Pixie-2.06

XS​:
version-0.95, but that is kept well in synch with core
ExtUtils​::ParseXS as included by​:
- Memcached-libmemcached (test suite)
Linux-CDROM-0.02
Mouse-0.97
Text-Xslate-1.5007
libapreq2-2.13

2 functions probably​: for registering, and for checking if there's
overloading in place (if I'm following you), like the Overloaded and
Method functions.

I was only thinking in terms of what CPAN modules already do. All the
XS ones just register overloading. Most of the pure-Perl ones do the
same; some inspect the stash instead of calling overload'Overloaded;
some inspect the stash to find out the fallback value, for which we
currently have no interface. (I’ve just realised that I made
overload'Method("fallback") return the fallback value in 50853fa, and
then stopped that from working in 3866ea3.)

In any case, the registration interface could be​:

hv_amagic_register(HV *stash, const char *op, SV *value)

with a NULL op for registering and a NULL value for the ‘no overload’
equivalent.

I’m suggesting amagic rather than overload in the name, because there
are already two API functions containing it. But maybe overload would
be better.

For enquiry, which is best?

hv_amagic(HV *stash, const char *op)
hv_amagic_get(...)
hv_amagic_method(...)

Maybe we should use get and set, for parallelism.

Can we get an update on the status of this ticket?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2013

From @cpansprout

On Sat Jun 29 18​:30​:37 2013, jkeenan wrote​:

Can we get an update on the status of this ticket?

I think we still need APIs for finding out the overload fallback value
and XS APIs for finding out other values. But I don‘t think it’s high
priority. I do think it should be left open still, though perhaps with
a different subject.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Dec 25, 2013

From @jkeenan

On Sat Jun 29 18​:58​:01 2013, sprout wrote​:

On Sat Jun 29 18​:30​:37 2013, jkeenan wrote​:

Can we get an update on the status of this ticket?

I think we still need APIs for finding out the overload fallback value
and XS APIs for finding out other values. But I don‘t think it’s high
priority. I do think it should be left open still, though perhaps with
a different subject.

At http​://www.cpantesters.org/distro/M/Mouse.html, Mouse 2.1.0 is passing on 5.19* and earlier versions on multiple platforms.

So the original rationale for this ticket appears to be moot.

Father C, could you either rename this ticket to reflect what issues still need discussion? Or perhaps close this and open up a fresh ticket?

Thank you very much.
Jim Keenan

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