Re: Allomopherencing

2005-09-25 Thread Ashley Winters
On 9/25/05, Yuval Kogman <[EMAIL PROTECTED]> wrote: > > In order to enforce that level of compile-time type safely, you should > > need to declare my Dog $dog, or stick a pragma up top: > > That's the point of my question - why? What do I lose by > inferrencing? Nothing that I see. I recant my arg

Re: matching colors (was Stringification, numification, and booleanification of pairs)

2005-09-25 Thread Ashley Winters
On 9/25/05, Luke Palmer <[EMAIL PROTECTED]> wrote: > On 9/25/05, Juerd <[EMAIL PROTECTED]> wrote: > > We can do better than equivalence testing for colors. Instead, try to > > match. Surely a *smart* match operator really is smart? > > > > $color ~~ '#FF00FF' > >== > > $color ~~

Re: Branch Review

2005-09-25 Thread Chip Salzenberg
This is pretty long as is, so I'm going to leave out all the things I agree with. On Fri, Sep 09, 2005 at 01:48:20PM +0200, Leopold Toetsch wrote: > Chip writes: > > * optional parameter interface: ":opt_count" -> ":opt_flag" > > So ":opt_count" should be replaced with ":opt_flag", which set

Re: [perl #17490] Magic is useless unless verifiable.

2005-09-25 Thread Chip Salzenberg
On Sun, Sep 25, 2005 at 10:04:16AM -1000, Joshua Hoblitt wrote: > * Expands the header to be 32 bytes in size. OK > * The magic number is no longer an opcode outside the header. It is > now an 8 byte magic string at the the beginning of the header. I should think four would do, but no m

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Mark A. Biggar
In a private conversation with Larry this afternoon, he said that by default "$foo" and ~$foo and $foo.as(Str) all give the same result (assuming scalar context, etc.). And that "@foo[]" and [EMAIL PROTECTED] and @foo.as(Str) are the same as join(' ', @foo) where join is effectively: sub join

numification and stringification of objects

2005-09-25 Thread Juerd
Whenever possible, object should have useful numeric and string representations. These are generally lossy, but this is not a problem, because a scalar stays a scalar even after being used in a certain context, and the object isn't lost. When a protocol or data format that already has a string for

Re: Howto make 'require' fail ?

2005-09-25 Thread Michael G Schwern
On Sun, Sep 25, 2005 at 07:53:40PM -0400, Randy W. Sims wrote: > I haven't tried overriding yet, but your mention of a change in > internals reminds me of another approach I had tried without success. > The docs imply in its psuedo perl version of C that I might be > able to set $INC{'Foo.pm'} t

Re: Howto make 'require' fail ?

2005-09-25 Thread Randy W. Sims
Michael G Schwern wrote: On Sat, Sep 24, 2005 at 02:13:46PM -0400, Randy W. Sims wrote: Is there a way to make C or C fail without manipulating @INC or hiding the physical file? Or more generally, how do you test all branches of constructs like: if ( eval {require Foo} ) { useFoo(); } elsif

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Juerd
Mark Overmeer skribis 2005-09-25 17:28 (+0200): > Stringification/Numification should be used to let an object play its > natural role within the program. Agreed, but... > For instance, some "Temperature" object producing 273 when compared to > the melting point of water. That's for numeric cont

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Mark Overmeer
* wolverian ([EMAIL PROTECTED]) [050925 11:57]: > On Sun, Sep 25, 2005 at 12:52:08PM +0200, Juerd wrote: > > Hackers on this list, what do you think? > > I think separating the two is extremely confusing. I do not see any uses > for it, but maybe I am not thinking hard enough. Of course, having

Re: [perl #17490] Magic is useless unless verifiable.

2005-09-25 Thread Joshua Hoblitt
On Sun, Sep 25, 2005 at 12:24:52PM -0700, Chip Salzenberg via RT wrote: > I think the right answer is to use a magic string rather than a > magic number. Leo and I been discussing this on #parrot and we've come to the same conclusion. Attached is a possible patch for parrotbyte.pod that implement

Re: Testing dual XS/Perl modules

2005-09-25 Thread Michael G Schwern
On Sun, Sep 25, 2005 at 06:00:04PM +0200, demerphq wrote: > Is there a proper way to test both parts of dual implementation modules? > > In a pinch i came up with > > use DynaLoader; > sub DynaLoader::bootstrap{1}; # Don't dynaload anything please. > > use Scalar::Util qw(refaddr); #pure

Re: Howto make 'require' fail ?

2005-09-25 Thread Michael G Schwern
On Sat, Sep 24, 2005 at 02:13:46PM -0400, Randy W. Sims wrote: > Is there a way to make C or C fail without manipulating > @INC or hiding the physical file? Or more generally, how do you test all > branches of constructs like: > > if ( eval {require Foo} ) { > useFoo(); > } elsif ( eval {requi

Re: matching colors (was Stringification, numification, and booleanification of pairs)

2005-09-25 Thread Luke Palmer
On 9/25/05, Juerd <[EMAIL PROTECTED]> wrote: > We can do better than equivalence testing for colors. Instead, try to > match. Surely a *smart* match operator really is smart? > > $color ~~ '#FF00FF' >== > $color ~~ 'magenta' >== > $color ~~ [ 255, 0, 255 ] Hmm.

Re: Howto make 'require' fail ?

2005-09-25 Thread Ivan Tubert-Brohman
Randy W. Sims wrote: Is there a way to make C or C fail without manipulating @INC or hiding the physical file? Check out Devel::Hide. I've never used it, but it's supposed to do that. From the SYNOPSIS: use Devel::Hide qw(Module/ToHide.pm); require Module::ToHide; # fails use Devel::Hi

Re: Graphing Perl Packages, updated

2005-09-25 Thread Adam Kennedy
Michael G Schwern wrote: On Fri, Sep 23, 2005 at 05:38:32PM +0200, Tels wrote: If you have any ideas how to make this even more usefull, please speak now. I will have limited email reading/writing capabilities the next two weeks, but I *will* respond to all emails/critics/praises, even though i

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Juerd
Ashley Winters skribis 2005-09-25 12:26 (-0700): > It's not a Date, it's a UnixEpochTimestamp. That is precisely the flaw. Are you honestly likely to have that class? If you really need an unix epoch timestamp, wouldn't you just use a very simple integer for that? Because that's what it *is*, b

matching colors (was Stringification, numification, and booleanification of pairs)

2005-09-25 Thread Juerd
Yuval Kogman skribis 2005-09-25 21:34 (+0300): > > if $color.as(Str) eq '#FF00FF' and "$color" eq "magenta" { > > $Ashley++; > > } > $color.hex_triplet; # no alpha > $color.name; # if we have one... or we can try to make one up (#ff0033 is > bluish red ;-) We can do better than equivalence test

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Ashley Winters
On 9/25/05, Yuval Kogman <[EMAIL PROTECTED]> wrote: > On Sun, Sep 25, 2005 at 10:59:38 -0700, Ashley Winters wrote: > > > The Stringification of a UnixEpochTimestamp should probably be the > > same as its Integerization -- 12345678900. However, the Interpolation > > of it should be the locale-speci

Re: [perl #17490] Magic is useless unless verifiable.

2005-09-25 Thread Chip Salzenberg
On Thu, Sep 22, 2005 at 12:07:48PM -0400, Matt Fowles wrote: > > > Mark Biggar writes: > > > d) use a magic number that can also be used as the byte order indicator. > > I have seen architectures that swap byte ordering for 8 byte things > (like doubles) but not 4 byte things. So that gives 3 op

Re: Allomopherencing

2005-09-25 Thread Yuval Kogman
On Sun, Sep 25, 2005 at 11:24:05 -0700, Ashley Winters wrote: > I can't accept that. While you can infer that $dog will be a Dog at > that line of code, it isn't being enforced, which means no > compile-time error. $dog is allowed to store any kind of data, and you > only know what methods exist in

Re: Exceptuations

2005-09-25 Thread Yuval Kogman
On Sun, Sep 25, 2005 at 11:32:54 -0600, Luke Palmer wrote: > Exactly which exception is continued? ... > This comes up again with open(). So it's somewhere in between. > Where? For the open() example I don't have a solution but I know in what direction to throw it: the same thing that makes croa

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Yuval Kogman
On Sun, Sep 25, 2005 at 10:59:38 -0700, Ashley Winters wrote: > The Stringification of a UnixEpochTimestamp should probably be the > same as its Integerization -- 12345678900. However, the Interpolation > of it should be the locale-specific POSIX-style datetime string. Why? What value does the st

Re: Allomopherencing

2005-09-25 Thread Ashley Winters
On 9/25/05, Ashley Winters <[EMAIL PROTECTED]> wrote: > On 9/25/05, Yuval Kogman <[EMAIL PROTECTED]> wrote: > > Under strict type inferrencing, i'd expect this to be a compile time > > error: I quoted but didn't read close enough. You DID say strict type inferencing. Never mind. :) Ashley Winters

Re: Allomopherencing

2005-09-25 Thread Ashley Winters
On 9/25/05, Yuval Kogman <[EMAIL PROTECTED]> wrote: > Hmm... Making up these subjects is fun =) Very interesting. :) > Under strict type inferrencing, i'd expect this to be a compile time > error: > > my $dog = Dog.new; > > if ($condition) { > my Cat $c = $dog; >

Re: Exceptuations

2005-09-25 Thread Michael Walter
On 9/25/05, Luke Palmer <[EMAIL PROTECTED]> wrote: > [...] > Exactly which exception is continued? > [...] Named restarts in Common Lisp appear to try to solve a related problem, if I'm skimming this thread correctly. :-) (see [1]). Michael [1] http://www.supelec.fr/docs/cltl/clm/node312.html#SE

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Ashley Winters
On 9/25/05, Yuval Kogman <[EMAIL PROTECTED]> wrote: > On Sun, Sep 25, 2005 at 12:52:08 +0200, Juerd wrote: > > Damian Conway skribis 2005-09-24 8:31 (+1000): > > > >In my opinion, making the string value in interpolation different from > > > >the value in Str context is madness. > > > It's dwimmer

Re: Exceptuations

2005-09-25 Thread Luke Palmer
On 9/25/05, Yuval Kogman <[EMAIL PROTECTED]> wrote: > I propose a new model - each exception has a continuation that > allows it to be unfatalized. I think we've already talked about something like this. But in the presence of "use fatal", it makes a lot more sense. Something comes to mind:

Allomopherencing

2005-09-25 Thread Yuval Kogman
Hmm... Making up these subjects is fun =) Anywho... Since type inferrencing is going to make into Perl 6, and allomorphism is very richly supported by the type system, i'm wondering on the nature of the optionality... What excatly do the users get to control? Are functions with '-->' rich type s

Testing dual XS/Perl modules

2005-09-25 Thread demerphq
Is there a proper way to test both parts of dual implementation modules? In a pinch i came up with use DynaLoader; sub DynaLoader::bootstrap{1}; # Don't dynaload anything please. use Scalar::Util qw(refaddr); #pure perl implementation to disable an XS implementation of a module that used

Re: Exceptuations - CPS explained

2005-09-25 Thread Yuval Kogman
To ease the understanding of exactly how this might work, assume that perl 6 is really all continuation passing style under the surface (parrot is ;-). use fatal; my $x = do_bar(); do_foo(); sub do_bar { fail "bah"; } The way CPS works is r

Re: Howto make 'require' fail ?

2005-09-25 Thread Randy W. Sims
Michael Graham wrote: Ivan Tubert-Brohman <[EMAIL PROTECTED]> wrote: Randy W. Sims wrote: Is there a way to make C or C fail without manipulating @INC or hiding the physical file? Check out Devel::Hide. I've never used it, but it's supposed to do that. Another strategy is to take advant

Re: Exceptuations

2005-09-25 Thread Yuval Kogman
On Sun, Sep 25, 2005 at 18:11:22 +0300, Yuval Kogman wrote: > In order to support continuable exception generators, here is a > style guide for exception values, and an observation on what > exceptions should support at the language level: And more... * Exception strings are for humans Humans ne

Re: Howto make 'require' fail ?

2005-09-25 Thread Michael Graham
Ivan Tubert-Brohman <[EMAIL PROTECTED]> wrote: > Randy W. Sims wrote: > > Is there a way to make C or C fail without manipulating > > @INC or hiding the physical file? > > Check out Devel::Hide. I've never used it, but it's supposed to do that. Another strategy is to take advantage of the fact t

Re: Exceptuations

2005-09-25 Thread Yuval Kogman
In order to support continuable exception generators, here is a style guide for exception values, and an observation on what exceptions should support at the language level: * Exceptions should preserve data All exceptions should contain as much of the original data that caused them... With Luke

Exceptuations

2005-09-25 Thread Yuval Kogman
Hi, Suppose I'm writing a file browser, with a pane on the left to display the filesystem hierarchy, and a frame on the right to preview the file. Suppose I have a convenience function, preview_file which takes a path and returns a value that the frame display view knows to render. Let's define

Re: Howto make 'require' fail ?

2005-09-25 Thread Ivan Tubert-Brohman
Randy W. Sims wrote: Is there a way to make C or C fail without manipulating @INC or hiding the physical file? Check out Devel::Hide. I've never used it, but it's supposed to do that. From the SYNOPSIS: use Devel::Hide qw(Module/ToHide.pm); require Module::ToHide; # fails use Devel::Hi

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Yuval Kogman
On Sun, Sep 25, 2005 at 12:52:08 +0200, Juerd wrote: > Damian Conway skribis 2005-09-24 8:31 (+1000): > > >In my opinion, making the string value in interpolation different from > > >the value in Str context is madness. > > It's dwimmery. > > It's dwymmery, or dwdmmery indeed. Not at all what I m

[perl #37258] loadlib and libraries with '.' in the name

2005-09-25 Thread via RT
# New Ticket Created by Ross # Please include the string: [perl #37258] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/rt3/Ticket/Display.html?id=37258 > email thread discussing the issue: http://www.nntp.perl.org/group/perl.perl6.internals/30

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread wolverian
On Sun, Sep 25, 2005 at 12:52:08PM +0200, Juerd wrote: > Hackers on this list, what do you think? I think separating the two is extremely confusing. I do not see any uses for it, but maybe I am not thinking hard enough. -- wolverian signature.asc Description: Digital signature

Re: New kwalitee test, has_changes

2005-09-25 Thread Adam Kennedy
Paul Johnson wrote: On Fri, Sep 23, 2005 at 12:06:43PM +0200, Thomas Klausner wrote: Hi! On Fri, Sep 23, 2005 at 12:54:42PM +1000, Adam Kennedy wrote: Collecting any sort of coverage data is a complete bitch. Let me just say right now that doing it across _all_ of CPAN is flat out impossib

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Juerd
Damian Conway skribis 2005-09-24 8:31 (+1000): > They ought to, since the two are different in Perl 5. > For example: > my @bar = 'bar'; > print "[EMAIL PROTECTED]"; > print "foo[" . @bar . "]baz\n"; This does not compare stringification to interpolation. It compares scalarification t

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Juerd
Damian Conway skribis 2005-09-24 8:31 (+1000): > >In my opinion, making the string value in interpolation different from > >the value in Str context is madness. > It's dwimmery. It's dwymmery, or dwdmmery indeed. Not at all what I mean, am likely to mean, or will ever mean. > Which often looks l

RE: Graphing Perl Packages, updated

2005-09-25 Thread Jan Dubois
On Fri, 23 Sep 2005, Michael G Schwern wrote: > On Fri, Sep 23, 2005 at 07:33:04PM +0200, Tels wrote: > > Not yet. Good idea. The relevant code is in parse_file() in > > gen_graph - it gets as option one .pm file and then does something > > with it. > > > > The lopp for each file is in gather_data(

Call for IRIX testers - was Re: [perl #27003] bytecode (header?) problem in tru64/alpha

2005-09-25 Thread Joshua Hoblitt
Does anyone has access to an IRIX machine? -J -- On Thu, Sep 22, 2005 at 07:37:44PM +0300, Jarkko Hietaniemi wrote: > > > > > Jarkko, > > > > Are there still outstanding issues on IRIX? AFAIK nobody else has been > > building parrot on that platform. > > Unfortunately I no more have access t

Re: New kwalitee test, has_changes

2005-09-25 Thread Adam Kennedy
It's impossible. Quite. I believe the only way is for the author to do the Devel::Cover dance and forward the results. It also distributes the workload out to where it should be done. Since it's an optional step that has no direct bearing on the functionality of the module, it's a sign tha

Howto make 'require' fail ?

2005-09-25 Thread Randy W. Sims
Is there a way to make C or C fail without manipulating @INC or hiding the physical file? Or more generally, how do you test all branches of constructs like: if ( eval {require Foo} ) { useFoo(); } elsif ( eval {require Alternate} ) { useAlternate(); } else { fake_it(); } Thanks, Randy

Re: Stringification, numification, and booleanification of pairs

2005-09-25 Thread Damian Conway
Juerd wrote: But will they also see "foo" ~ $bar as something different from "foo$bar"? They ought to, since the two are different in Perl 5. For example: my @bar = 'bar'; print "[EMAIL PROTECTED]"; print "foo[" . @bar . "]baz\n"; And what context does "foo{ $bar }" use? Strin