Re: identity tests and comparing two references

2005-03-31 Thread Sam Vilain
Darren Duncan wrote: Now I seem to remember reading somewhere that '===' will do what I want, but I'm now having trouble finding any mention of it. So, what is the operator for reference comparison? As someone who wrote a tool that uses refaddr() and 0+ in Perl 5 to achieve the same thing, I agre

identity tests and comparing two references

2005-03-31 Thread Darren Duncan
As I continue porting code to Perl 6, I found something else that the synopsis don't seem to explain clearly. What I want to be able to do is compare two references to see if they point to the same thing, in this case an object, but in other cases perhaps some other type of thing. In synopsis

Re: Documentary annotations: $what doc

2005-03-31 Thread Ashley Winters
Chip Salzenberg writes: > I'd like to annotate Perl 6 parameters and other entities using > traits, since that's the best way (I know of) to have them appear > immediately in the text of the program where they are. > > Supposing I had a "doc" trait, could I say: > > sub f2c (Num $temp doc) >

Re: Documentary annotations: $what doc

2005-03-31 Thread Michael Walter
Make "is" polymorphic :D Michael On Thu, 31 Mar 2005 21:24:52 -0500 (EST), Abhijit Mahabal <[EMAIL PROTECTED]> wrote: > On Thu, 31 Mar 2005, Luke Palmer wrote: > > > Chip Salzenberg writes: > >> I'd like to annotate Perl 6 parameters and other entities using > >> traits, since that's the best w

Re: Documentary annotations: $what doc

2005-03-31 Thread Abhijit Mahabal
On Thu, 31 Mar 2005, Luke Palmer wrote: Chip Salzenberg writes: I'd like to annotate Perl 6 parameters and other entities using traits, since that's the best way (I know of) to have them appear immediately in the text of the program where they are. Supposing I had a "doc" trait, could I say: su

Re: Documentary annotations: $what doc

2005-03-31 Thread Luke Palmer
Chip Salzenberg writes: > I'd like to annotate Perl 6 parameters and other entities using > traits, since that's the best way (I know of) to have them appear > immediately in the text of the program where they are. > > Supposing I had a "doc" trait, could I say: > > sub f2c (Num $temp doc) >

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread Aaron Sherman
On Thu, 2005-03-31 at 15:25, chromatic wrote: > On Thu, 2005-03-31 at 13:11 -0500, Aaron Sherman wrote: > > I can't answer most of these well. However... > Open-Closed is a great idea until the most natural and easiest way to do > something is to to redefine a little bit of the world. You seem

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread Jonathan Scott Duff
I'm no expert, but here's my take: On Thu, Mar 31, 2005 at 01:11:37PM -0500, Aaron Sherman wrote: > If you declare a variable to be of a type (let's even say a class to be > specific), then you have hinted to the compiler as to the nature of that > variable, but nothing is certain. > > That is to

Documentary annotations: $what doc

2005-03-31 Thread Chip Salzenberg
I'd like to annotate Perl 6 parameters and other entities using traits, since that's the best way (I know of) to have them appear immediately in the text of the program where they are. Supposing I had a "doc" trait, could I say: sub f2c (Num $temp doc) doc {...} Or would I be for

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread chromatic
On Thu, 2005-03-31 at 13:11 -0500, Aaron Sherman wrote: I can't answer most of these well. However... > > One additional wrinkle is that *anyone* is allowed to declare a > > class non-cooperative (open or non-final) during *any* part of the > > compilation > > ... even after it is declared fina

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread Aaron Sherman
On Thu, 2005-03-31 at 11:51, Larry Wall wrote: > my X $a; > > is *necessary* but not *sufficient* to do method existence testing in > standard Perl 6 at compile time. You can do it IFF you have the class > information AND the classes are willing to cooperate in your scheme. > In the current

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread Larry Wall
On Thu, Mar 31, 2005 at 06:35:06PM +0200, Thomas Sandlaß wrote: : Is typing optional in the sense that it is no syntax error but : otherwise ignored? To me this is pain but no gain :( Well, you guys keep ignoring the answer. Let me put it a bit more mathematically. The information in my X $

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread Thomas Sandlaß
Miroslav Silovic wrote: Remember, you can even change the class of instanced objects using 'does' (or 'but', but it'll at least copy the object). And as the example above shows, this is statically intractable - it can happen in a sub in a different autoloaded module. Sorry this is a well establi

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: Er, isn't that not just the wrong way around? The point is to do the bookkeeping that an object is needed that does .meth() and that it is stored in $a, and to complain when that is not the case when it should be. The earlier the better. I don't understand why writing 'my X

Re: S28ish [was: [Pugs] A couple of string interpolation edge cases]

2005-03-31 Thread Thomas Sandlaß
Larry Wall wrote: On Sat, Mar 26, 2005 at 02:37:24PM -0600, Rod Adams wrote: : How can you have a level independent position? By not confusing positions with numbers. They're just pointers into a particular string. I'm not the Unicode guru but my understanding is that all composition sequences are

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-31 Thread Thomas Sandlaß
Thomas Sandlaà wrote: Int|Str <: Str && Str <: Int|Str && Int|Str <: Int && Int <: Int|Str holds. Uhh, I hardly believe that it was me writing that last night! Int|Str is of course a proper supertype of Int and Str respectively. So we really have: Str <: Str|Int && Int <: Str|Int, which warps us