Re: [perl #131333] use of undeclared attributes gives not useful line number in error

2017-05-20 Thread Elizabeth Mattijsen via RT

> On 20 May 2017, at 13:20, mt1957 (via RT)  
> wrote:
> 
> # New Ticket Created by  mt1957 
> # Please include the string:  [perl #131333]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=131333 >
> 
> 
> in perl version 2017.04.3-287-g3e7675a built on MoarVM version 
> 2017.04-64-g6d5ea04
> implementing Perl 6.c I see the following error;
> 
> 
> t/120-Decimal128.t .. ===SORRY!=== Error while compiling 
> /home/marcel/Languages/Perl6/Projects/BSON/lib/BSON/Decimal128.pm6 
> (BSON::Decimal128)
> Attribute $!sstring not declared in class BSON::Decimal128
> at /home/marcel/Languages/Perl6/Projects/BSON/lib/BSON/Decimal128.pm6 
> (BSON::Decimal128):92
> 
> 
> This is  a writing error of course of attribute $!string. The line 
> number however, was at the end of the module and not at the (first) 
> location where it is used.

Fixing this would involve remembering where an attribute was first mentioned, 
as this is fully legal:

  class A { method a { $!a }; has $!a }

aka, specifying the attribute *after* it was mentioned.  So it wouldn’t know it 
wasn’t defined until it hit the end of the class.


Re: [perl #131333] use of undeclared attributes gives not useful line number in error

2017-05-20 Thread Elizabeth Mattijsen

> On 20 May 2017, at 13:20, mt1957 (via RT)  
> wrote:
> 
> # New Ticket Created by  mt1957 
> # Please include the string:  [perl #131333]
> # in the subject line of all future correspondence about this issue. 
> # https://rt.perl.org/Ticket/Display.html?id=131333 >
> 
> 
> in perl version 2017.04.3-287-g3e7675a built on MoarVM version 
> 2017.04-64-g6d5ea04
> implementing Perl 6.c I see the following error;
> 
> 
> t/120-Decimal128.t .. ===SORRY!=== Error while compiling 
> /home/marcel/Languages/Perl6/Projects/BSON/lib/BSON/Decimal128.pm6 
> (BSON::Decimal128)
> Attribute $!sstring not declared in class BSON::Decimal128
> at /home/marcel/Languages/Perl6/Projects/BSON/lib/BSON/Decimal128.pm6 
> (BSON::Decimal128):92
> 
> 
> This is  a writing error of course of attribute $!string. The line 
> number however, was at the end of the module and not at the (first) 
> location where it is used.

Fixing this would involve remembering where an attribute was first mentioned, 
as this is fully legal:

  class A { method a { $!a }; has $!a }

aka, specifying the attribute *after* it was mentioned.  So it wouldn’t know it 
wasn’t defined until it hit the end of the class.

[perl #131333] use of undeclared attributes gives not useful line number in error

2017-05-20 Thread via RT
# New Ticket Created by  mt1957 
# Please include the string:  [perl #131333]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=131333 >


in perl version 2017.04.3-287-g3e7675a built on MoarVM version 
2017.04-64-g6d5ea04
implementing Perl 6.c I see the following error;


t/120-Decimal128.t .. ===SORRY!=== Error while compiling 
/home/marcel/Languages/Perl6/Projects/BSON/lib/BSON/Decimal128.pm6 
(BSON::Decimal128)
Attribute $!sstring not declared in class BSON::Decimal128
at /home/marcel/Languages/Perl6/Projects/BSON/lib/BSON/Decimal128.pm6 
(BSON::Decimal128):92


This is  a writing error of course of attribute $!string. The line 
number however, was at the end of the module and not at the (first) 
location where it is used.


Regards,
marcel


Re: Undeclared attributes

2004-12-10 Thread Abhijit Mahabal
Dave Whipp wrote:
Attributes are declared with Chas, but also have a unique signil 
C$.. So is it strictly necessary to declare them? Or rather, is it 
Cno strictly necessary -- i.e. is the following legal?

no strict;
class Foo {
  method bar {
   say $.a++
  }
}
For the standard layout, I'd think it'd be good to declare the
attributes, but perhaps not necessary. An object of class C, IIRC, will
just be an object in the parrot sense; doing an Caddattribute Px, Sy
will cause the attribute to be added to all other objects of that class,
 and to all objects that is or does that class; That might involve
a whole lot of work.
But maybe you are asking if Perl6 can intuit that you implied an
unwritten Chas $.a But it could be a Chas $.a or Cour $.a or
Cmy $.a.
BTW, should we be able to write pragmas like this:
class Foo isnt strict{...}
or
class Foo isn't strict{...}
--abhijit



Undeclared attributes

2004-12-10 Thread Dave Whipp
Attributes are declared with Chas, but also have a unique signil 
C$.. So is it strictly necessary to declare them? Or rather, is it 
Cno strictly necessary -- i.e. is the following legal?

no strict;
class Foo {
  method bar {
   say $.a++
  }
}