Re: A6 questions

2003-03-17 Thread David Storrs
On Sun, Mar 16, 2003 at 10:08:41PM -0500, Chris Dutton wrote: > On Sunday, March 16, 2003, at 05:09 PM, David Storrs wrote: > > > ==QUESTION > > - Page 8 says "In some languages, all methods are multimethods." I > > believe that Java is one of these. Is that right and what are some > > others?

Apoc 5 - some issues

2003-03-17 Thread Matthijs van Duin
OK, I've recently spent some intimate time with Apocalypse 5 and it has left me with a few issues and questions. If any of this has already been discussed, I'd appreciate some links (I've searched google groups but haven't found anything applicable) 1. Sub-rules and backtracking #

Re: A6 questions

2003-03-17 Thread Luke Palmer
> ==QUESTION > - Given the following code, what is called by $ride.current_speed()? > > class Vehicle { > my $speed; > method current_speed() { return $speed; } > method set_speed($n) { $speed = $n; } > } > > class Car { > submethod current_speed() { >

Re: Apoc 5 - some issues

2003-03-17 Thread Luke Palmer
> 1. Sub-rules and backtracking > > > # call rule, passing Perl args > >{ .name(expr) } # same thing. > > ># call rule, passing regex arg > >{ .name(/pat/) } # same thing. > > Considering perl can't sanely know how to backtrack into a closure, woul

Re: is static?

2003-03-17 Thread Larry Wall
On Sun, Mar 16, 2003 at 04:22:27PM +0200, arcadi shehter wrote: : it's interesting that "has" have more or less required scope -- its : visible only from object methods and it keeps its value , so maybe : something like this : : : sub foo() { : has $s //= 0; : $s ++ ; : } : : print foo,

Re: A6: Complex Parameter Types

2003-03-17 Thread Luke Palmer
> Nick -- > > I've been thinking of it like this: > > class int isa intlike; # and isa value or whatever > class Int isa intlike; # and isa Object or whatever > > class num isa numlike; # and isa value or whatever > class Num isa numlike; # and isa Object or whatever > > ... > > cl

Re: is static?

2003-03-17 Thread arcadi shehter
Joe Gottman writes: > >Not really. A variable declared with can be accessed from > anywhere in the program, just by redeclaring it or calling it with the > "package::" syntax.A variable declared with can be accessed outside > its scope only if the user returns a reference to it.

Re: is static?

2003-03-17 Thread Smylers
Uri Guttman writes: > talking about nested subs brought up another related idea, static (not > on the stack) lexicals inside subs. the current solution in p5 is to > declare them in a surrounding block and that is slightly ugly. and if > you want multiple subs to share them they all have to be in

Re: A6 questions

2003-03-17 Thread Marco Baringer
Chris Dutton <[EMAIL PROTECTED]> writes: > On Sunday, March 16, 2003, at 05:09 PM, David Storrs wrote: > > > ==QUESTION > > - Page 8 says "In some languages, all methods are multimethods." I > > believe that Java is one of these. Is that right and what are some > > others? (This is really just

Re: Apoc 5 - some issues

2003-03-17 Thread Matthijs van Duin
On Mon, Mar 17, 2003 at 11:17:21AM -0700, Luke Palmer wrote: > # call rule, passing Perl args >{ .name(expr) } # same thing. Considering perl can't sanely know how to backtrack into a closure, wouldn't { .name(expr) } be equal to : instead? Nope. : is equivalent to { .n

Re: A6 questions

2003-03-17 Thread David Storrs
On Mon, Mar 17, 2003 at 10:56:51AM -0700, Luke Palmer wrote: > Assuming the obvious inheritance, Vehicle.set_speed() would be called. Ok good, that's what I thought. Thanks. > No. Rules fit better in a grammar than subs, and help the psychology > of people in various ways. For instance: > >

Re: A6: Complex Parameter Types

2003-03-17 Thread Michael Lazzaro
On Monday, March 17, 2003, at 10:35 AM, Luke Palmer wrote: I've been thinking of it like this: class int isa intlike; # and isa value or whatever class Int isa intlike; # and isa Object or whatever class num isa numlike; # and isa value or whatever class Num isa numlike; # and isa Object

Re: A6 questions

2003-03-17 Thread Matthijs van Duin
On Mon, Mar 17, 2003 at 10:52:26AM -0800, David Storrs wrote: sub identifier {m{ <[\w]-[\d]> \w+ }} rule identifier { <[\w]-[\d]> \w } I personally don't see a lot of difference between those two, but I'll go with you on the "helps people know that $match should be a regex" point. Good eno

Re: Apoc 5 - some issues

2003-03-17 Thread Luke Palmer
> On Mon, Mar 17, 2003 at 11:17:21AM -0700, Luke Palmer wrote: > >> > # call rule, passing Perl args > >> >{ .name(expr) } # same thing. > >> > >> Considering perl can't sanely know how to backtrack into a closure, > >> wouldn't { .name(expr) } be equal to : instead? >

Re: Apoc 5 - some issues

2003-03-17 Thread Matthijs van Duin
On Mon, Mar 17, 2003 at 07:49:36PM +0100, Matthijs van Duin wrote: (blah blah I wrote on closures and rule-invocation) I'm not saying rules will be implemented in such a way, but it's the first thing that comes to mind. Before anyone replies, I just realized I should probably just first browse a

Re: A6: Complex Parameter Types

2003-03-17 Thread Dave Whipp
class Scalar isa intlike, numlike, ...; # and isa Object or whatever Qoting A6: "Perl makes a distinction between the type of the variable, and the type of the value" If we view Scalar as the type of a variable, not value, then we could cease to need all this cleverness with inheritance. Peopl

Re: PBC Object Files

2003-03-17 Thread Leopold Toetsch
Michael Collins wrote: Is there currently a specification for a pbc "object file" for linking and dynamic loading? No, not yet. Packfile loading and some parrot guts still need more cleanup for getting multiple bytecode sections running. By "object file" I guess mean a file that contains comp

PBC Object Files

2003-03-17 Thread Michael Collins
Is there currently a specification for a pbc "object file" for linking and dynamic loading? By "object file" I guess mean a file that contains compiled instructions plus a section with a table that maps subroutine/constant labels to their corresponding byte offsets within the file. If no, it mig

Re: [perl #21600] [PATCH] Enable buffer io in PIO

2003-03-17 Thread Dan Sugalski
At 10:38 AM + 3/17/03, "Jürgen" "Bömmels" (via RT) wrote: Next baby-step in PIO: Enabling buffering. This patch patch enables the formerly stubbed out buffering, and shakes out some bugs (Only the first part: Write buffering). Certainly all tests passed on my machine. Applied, thanks. Looks l

Re: [perl #21600] [PATCH] Enable buffer io in PIO

2003-03-17 Thread Benjamin Goldberg
"JüRgen BöMmels" wrote: [snip] > void > PIO_unix_flush(theINTERP, ParrotIOLayer *layer, ParrotIO *io) > { > -# if 0 > fsync(io->fd); > -# endif > } AFAIK, for disk files, fsync has (should have) no visible effect from the point of view of any user program -- all it does is tell the OS t

Re: Speed question: save/restore vs push/pop

2003-03-17 Thread Dan Sugalski
At 8:52 AM +0100 3/17/03, Leopold Toetsch wrote: Benjamin Goldberg wrote: How many "save"s does it take to be to be slower than one "push"? This really depends on the architecture, the running core and so on. But Dan estimated a cutoff value of 3, this test program indicates a cutoff of 2: For

Re: Speed question: save/restore vs push/pop

2003-03-17 Thread Leopold Toetsch
Benjamin Goldberg wrote: The answer to this question varies from platform to platform, and I've only go windows to test on... If I do 32 "save"s in a row, this will certainly be slower than doing a single "push". If I do 1 "save", this will (hopefully) be faster than 1 "push". Yep slightly. Ho

Re: Speed question: save/restore vs push/pop

2003-03-17 Thread Benjamin Goldberg
Steve Fink wrote: > > On Mar-17, Benjamin Goldberg wrote: > > > > The answer to this question varies from platform to platform, and > > I've only go windows to test on... > > > > If I do 32 "save"s in a row, this will certainly be slower than > > doing a single "push". > > > > If I do 1 "save", th

[perl #21600] [PATCH] Enable buffer io in PIO

2003-03-17 Thread Jürgen
# New Ticket Created by Jürgen Bömmels # Please include the string: [perl #21600] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt2/Ticket/Display.html?id=21600 > Next baby-step in PIO: Enabling buffering. This patch patch enables the formerly stub

Re: [perl #21588] [PATCH] uniq.pasm

2003-03-17 Thread Juergen Boemmels
Leon Brocard (via RT) <[EMAIL PROTECTED]> writes: > Well, it's more of a new file than a patch. I'm aware that we're in a > code freeze, so I don't mind if this doesn't get it right now, but > it'd be nice ;-) > > I've attached an example "uniq" implementation in pasm, which takes > options. It's

Re: is static?

2003-03-17 Thread Damian Conway
Larry wrote: : sub foo() { : has $s //= 0; : $s ++ ; : } : : print foo, foo, foo; This is interesting, but I think it would be a mistake to give C two unrelated meanings -- and I think we'd have to stretch our concepts of objects a little too far to consider these two meanings related

Re: is static?

2003-03-17 Thread Uri Guttman
> "DC" == Damian Conway <[EMAIL PROTECTED]> writes: DC> Larry wrote: >> : sub foo() { >> : has $s //= 0; : $s ++ ; >> : } >> : : print foo, foo, foo; DC> Futhermore, this approach opens another vermiferous can. I would argue DC> that C is the wrong way to initialize it,

Re: is static?

2003-03-17 Thread Damian Conway
Uri Guttman wrote: but that is a good name IMO. $s is static vs dynamic (on the stack). I don't think that names that describe implementation are nearly as good as names that describe behaviour. Not in a Very High Level Language, like Perl. other overloaded meanings of static from c/c++ are bag

Re: is static?

2003-03-17 Thread Uri Guttman
> "DC" == Damian Conway <[EMAIL PROTECTED]> writes: DC> Uri Guttman wrote: >> but that is a good name IMO. $s is static vs dynamic (on the stack). DC> I don't think that names that describe implementation are nearly as DC> good as names that describe behaviour. Not in a Very High Leve

Re: is static?

2003-03-17 Thread Joshua Hoblitt
> to me static IS a behavior. its value is static from call to call. > >> other overloaded meanings of static from c/c++ are baggage we can drop. I can see the potental for alot of ambiguaty between the meaning of 'is Static' and 'is Constant' (unless your a c/c++ programmer so your mind is al

Re: Apoc 5 - some issues

2003-03-17 Thread Luke Palmer
> On Mon, Mar 17, 2003 at 07:49:36PM +0100, Matthijs van Duin wrote: > >(blah blah I wrote on closures and rule-invocation) > > > >I'm not saying rules will be implemented in such a way, but it's the first > >thing that comes to mind. > > Before anyone replies, I just realized I should probably j

Re: Apoc 5 - some issues

2003-03-17 Thread Matthijs van Duin
On Mon, Mar 17, 2003 at 12:14:00PM -0700, Luke Palmer wrote: Before anyone replies, I just realized I should probably just first browse around in parrot since regex is already implemented ;-) No---you shouldn't do that. Regex (in languages/perl6) is a naive and is due for a rewrite. And I just re