Sub call resolution

2005-05-30 Thread Luke Palmer
Okay, I'd like to set myself straight. Sanity check: bar($foo, $baz); # looks for subs (lexical then package), and falls back to MMD $foo.bar($baz);# looks in ref($foo), then falls back to MMD If this is correct, can we simplify the latter to mean "MMD only" ? Would there be a mor

Re: mod/div

2005-05-30 Thread TSa (Thomas Sandlaß)
Mark Reed wrote: I would really like to see ($x div $y) be (floor($x/$y)) That is: floor( 8 / (-3) ) == floor( -2. ) == -3 Or do you want -2? and ($x mod $y) be ($x - $x div $y). Hmm, since 8 - (-3) == 11 this definition hardly works. But even with $q = floor( $x / $y ) and $r = $x

Re: Transparent / Opaque references = Link / Ref

2005-05-30 Thread Juerd
"TSa (Thomas Sandlaß)" skribis 2005-05-30 8:58 (+0200): > [This is a repost, somehow it didn't get through before, sorry.] This is the fourth time it did get through to my mailbox, at least. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http:/

Strongly typed containers?

2005-05-30 Thread Yuval Kogman
We already have the Set class, how do we say what it contains? class Set { has $.type; submethod BUILD { # get something into $.type, using 'of' handler } method members returns $.type () { ... } } my Set of Int $s = Set.new; # is this how you cal

construction clarification

2005-05-30 Thread Carl Franks
I have a class that normally takes a list of named arguments. I also want to be able to handle a single argument. class Foo { multi method new (Class $class: Str $date) { return $class.bless(date => $date); } submethod BUILD ($.date, $.time, $.offset) { # some error checking here

Re: Strongly typed containers?

2005-05-30 Thread TSa (Thomas Sandlaß)
Yuval Kogman wrote: my Set of Int $s = Set.new; # is this how you call it? This whole thing depends on how hard-wired the first level container implementation is. There is either a loose or very strict mapping from sigils to container types: $ --> Scalar/Item @ --> Array % --> Hash & -

class Foo does Debuggable ...

2005-05-30 Thread Yuval Kogman
Debugging is a hard task, because either too much is hidden (this is when we want to invoke the debugger), or too much is visible (this is when we give up on tracing the problem through the debugger, and resort to print Data::Dumper::Dumper($thing) every few lines of code). Given the complexity of

Re: Strongly typed containers?

2005-05-30 Thread Yuval Kogman
On Mon, May 30, 2005 at 18:51:19 +0200, "TSa (Thomas Sandla)" wrote: > class Set does Array {...} I don't like this... A set is just a simple example... What if I want something sillier? My question is really: "How do I make sub foo returns $computable" And how do I make this friendly

Re: Strongly typed containers?

2005-05-30 Thread Sam Vilain
Yuval Kogman wrote: > We already have the Set class, how do we say what it contains? > class Set { >has $.type; >method members returns $.type () { ... } > } > my Set of Int $s = Set.new; # is this how you call it? You are describing "Higher Order" types, also called Generic Algebraic Dat