Re: coercion

2022-02-11 Thread Marcel Timmerman
On 11-02-2022 15:58, Daniel Sockwell wrote: The question now is that I can't find anything about COERCE in the documentation. Yeah, COERCE definitely should be documented but just hasn't been yet. There's a raku/doc issue about needing to add it (https://github.com/Raku/doc/issues/3807) but u

Re: coercion

2022-02-11 Thread Daniel Sockwell
> The question now is that I can't find anything about COERCE in the > documentation. Yeah, COERCE definitely should be documented but just hasn't been yet. There's a raku/doc issue about needing to add it (https://github.com/Raku/doc/issues/3807) but unfortunately none of us has done so yet :

Re: coercion

2022-02-11 Thread Elizabeth Mattijsen
It is being tested in Roast, so I'd say it's not really that experimental anymore :-) > On 11 Feb 2022, at 15:20, Marcel Timmerman wrote: > > Hi, > > I stumbled over a discussion between Raku developers on > "Raku/proplem-solving" issue 227 "Coercion reconsidered and unified" and I > saw so

Re: Coercion/type checking: manually reproduce Perl6 standards

2018-09-01 Thread Fernando Santagata
Hello, I'm really glad to read of your experience, because I was wrestling just yesterday with a problem that feels similar. I wanted to write a simple sub which could accept both an Array and a List, and that was simple: use NativeCall; sub s(Positional $a) { CArray[num64].new: $a.map(|*)ยป.re

Re: Coercion of non-numerics to numbers

2007-03-05 Thread Larry Wall
On Mon, Mar 05, 2007 at 09:22:59AM -0800, Dave Whipp wrote: : I was wondering about the semantics of coercion of non-numbers, so I : experimented with the interactive Pugs on feather: : : pugs> +"42" : 42.0 : pugs> +"x42" : 0.0 : : I assume that pugs is assuming "no fail" in the interactive envi

Re: coercion and context

2005-09-14 Thread Dave Rolsky
On Wed, 14 Sep 2005, Luke Palmer wrote: my Int $int = $num; Explicit coercion, however, isn't done with context: it is done with the .as() method: $num.as(Int). I think that's weird. Not to mention the fact that you might have put an Int there for typechecking purposes instead of coersion pur

Re: coercion and context

2005-09-14 Thread Juerd
Luke Palmer skribis 2005-09-14 22:21 (+): > (conversely, is ~ just a Str context applicator?)? Yes, the way I think of it is that ~ is short for Str(), + is short for Num(), and ? is short for Bool(). > If a parent class defines a coercion operation, do you get it too > (and what are the imp

Re: coercion and context

2005-09-14 Thread Luke Palmer
On 9/14/05, Juerd <[EMAIL PROTECTED]> wrote: > Instead, if you don't want something to coerce, be explicit: > $foo.does(Blah) or fail;, or even: $foo.isa(Blah) or fail;.) We've been thinking of changing .isa to something longer, or a method on .meta, because it's a notion that is often misused. U