Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen
> On 2/11/19 3:27 AM, Timo Paulssen wrote: > > WHICH doesn't give you a numerical value. just print it as it is. > > > $ p6 'sub a (Buf $b) { say $b.WHICH }; my $c = Buf.new(1,2,3); say > $c.WHICH; a($c);' > Buf|71848984 > Buf|71848984 > > If "moarvm has a moving garbage collector" moves my 100

Re: subs and variables speed question

2019-02-11 Thread ToddAndMargo via perl6-users
On 11/02/2019 07:12, ToddAndMargo via perl6-users wrote: WHERE is pretty sweet command! $ p6 'sub a (Buf $b) { say $b.WHERE.base(0x10) }; my $c = Buf.new(1,2,3); say $c.WHERE.base(0x10); a($c);' 7F385D41334C 7F385D41334C On 11/02/2019 12:16, ToddAndMargo via perl6-users wrote: On 2/11/19

Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen
WHICH doesn't give you a numerical value. just print it as it is. On 11/02/2019 12:16, ToddAndMargo via perl6-users wrote: > On 2/11/19 2:52 AM, Timo Paulssen wrote: >> Please be aware that WHERE will give you the actual memory address of an >> object, but moarvm has a moving garbage collector,

Re: subs and variables speed question

2019-02-11 Thread ToddAndMargo via perl6-users
On 2/11/19 2:52 AM, Timo Paulssen wrote: Please be aware that WHERE will give you the actual memory address of an object, but moarvm has a moving garbage collector, which means that objects can change their memory location. at the moment it will only happen up to two times, i believe. you'll

Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen
Please be aware that WHERE will give you the actual memory address of an object, but moarvm has a moving garbage collector, which means that objects can change their memory location. at the moment it will only happen up to two times, i believe. you'll probably have a better result with .WHICH for

Re: subs and variables speed question

2019-02-10 Thread ToddAndMargo via perl6-users
the typos: Hi All, sub xxx( Buf $YugeBuf is ro ) {some miricle} Is $YugeBuf (up to 100 MB) a copy of the entire variable or just the structure?  I don't want the time hit of a copy. Many thanks, -T It is not a duplicate: [20:30] A question for the developers. sub xxx( Buf $YugeBuf is ro

Re: subs and variables speed question

2019-02-10 Thread ToddAndMargo via perl6-users
the typos: Hi All, sub xxx( Buf $YugeBuf is ro ) {some miricle} Is $YugeBuf (up to 100 MB) a copy of the entire variable or just the structure?  I don't want the time hit of a copy. Many thanks, -T It is not a duplicate: [20:30] A question for the developers. sub xxx( Buf $YugeBuf is ro

Re: subs and variables speed question

2019-02-10 Thread ToddAndMargo via perl6-users
WHERE is pretty sweet command! $ p6 'sub a (Buf $b) { say $b.WHERE.base(0x10) }; my $c = Buf.new(1,2,3); say $c.WHERE.base(0x10); a($c);' 7F385D41334C 7F385D41334C

Re: subs and variables speed question

2019-02-09 Thread ToddAndMargo via perl6-users
On 2/9/19 1:56 PM, ToddAndMargo via perl6-users wrote: Hi All, sub xxx( Buf $YugeBuf is ro ) {some midricle} Is $YugeBuf (up to 100 MB) a copy of just the structure? I don't want the time time of a copy. Many thanks, -T Without all the typos: Hi All, sub xxx( Buf $YugeBuf is ro ) {some

subs and variables speed question

2019-02-09 Thread ToddAndMargo via perl6-users
Hi All, sub xxx( Buf $YugeBuf is ro ) {some midricle} Is $YugeBuf (up to 100 MB) a copy of just the structure? I don't want the time time of a copy. Many thanks, -T

Re: reassigning values to variables question

2019-02-06 Thread yary
Hope that was as fun to write, as it was for me to read! Thanks. On Wed, Feb 6, 2019 at 12:50 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2/6/19 12:44 AM, ToddAndMargo via perl6-users wrote: > > On 2/5/19 11:56 PM, ToddAndMargo via perl6-users wrote: > >> On 2/5/19 8:34

Re: reassigning values to variables question

2019-02-06 Thread ToddAndMargo via perl6-users
On 2/6/19 12:44 AM, ToddAndMargo via perl6-users wrote: On 2/5/19 11:56 PM, ToddAndMargo via perl6-users wrote: On 2/5/19 8:34 PM, ToddAndMargo via perl6-users wrote: On Sun, Feb 3, 2019 at 9:36 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote:     Hi All,     If I

Re: reassigning values to variables question

2019-02-06 Thread ToddAndMargo via perl6-users
On 2/5/19 11:56 PM, ToddAndMargo via perl6-users wrote: On 2/5/19 8:34 PM, ToddAndMargo via perl6-users wrote: On Sun, Feb 3, 2019 at 9:36 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote:     Hi All,     If I have a variable of type Buf which 1000 bytes in it    

Re: reassigning values to variables question

2019-02-06 Thread ToddAndMargo via perl6-users
On 2/5/19 8:34 PM, ToddAndMargo via perl6-users wrote: On Sun, Feb 3, 2019 at 9:36 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote:     Hi All,     If I have a variable of type Buf which 1000 bytes in it     and I find the five bytes I want, is it faster, slower,    

Re: reassigning values to variables question

2019-02-05 Thread ToddAndMargo via perl6-users
On Sun, Feb 3, 2019 at 9:36 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: Hi All, If I have a variable of type Buf which 1000 bytes in it and I find the five bytes I want, is it faster, slower, or no difference in speed to overwrite the same

Re: reassigning values to variables question

2019-02-05 Thread yary
There are modules to time two pieces of code and show the difference https://github.com/perl6-community-modules/perl6-Benchy https://github.com/tony-o/perl6-bench You can write up the two versions you're thinking of, feed them to the benchmark module, and show us what you find! -y On Sun, Feb

reassigning values to variables question

2019-02-03 Thread ToddAndMargo via perl6-users
Hi All, If I have a variable of type Buf which 1000 bytes in it and I find the five bytes I want, is it faster, slower, or no difference in speed to overwrite the same variable with the five bytes? Or is it faster to put the five bytes from the first variable into a second variable? Many

Re: **@args question

2019-01-04 Thread ToddAndMargo via perl6-users
t @args, "\n"}; printx("abc",1,"def");' abc 1 def Question: $ p6 'sub printx(**@args){print(@args)}; printx("abc","xyz","def\n");' abc xyz def Are the spaces suppose to be there? In each case you are using 'print @args', then `print

Re: **@args question

2019-01-04 Thread ToddAndMargo via perl6-users
ers   > wrote:   >>   >> Hi All,   >>   >> Looking at   >>   >>  https://docs.perl6.org/routine/print   >>   >> I see   >>   >>  multi sub print(**@args --> True)   >>   >> Question.  If I wanted to create my own pr

Re: **@args question

2019-01-04 Thread ToddAndMargo via perl6-users
>> >> Looking at >> >> https://docs.perl6.org/routine/print >> >> I see >> >> multi sub print(**@args --> True) >> >> Question. If I wanted to create my own print routine >> using **@args, how would I declare

Re: **@args question

2019-01-03 Thread Brad Gilbert
> >> > > >> Looking at > > >> > > >> https://docs.perl6.org/routine/print > > >> > > >> I see > > >> > > >> multi sub print(**@args --> True) > > >> > > >> Question. I

Re: **@args question

2019-01-03 Thread Richard Hainsworth
The term "slurpy" did help a lot. :-) I am writing your explanation down for my records. Well Golly! $ p6 'sub printx(**@args){print(@args)}; printx("abc",1,"def\n");' abc 1 def $ p6 'sub printx(**@args){print @args, "\n"}; printx("abc"

Re: **@args question

2019-01-02 Thread ToddAndMargo via perl6-users
On 1/2/19 10:17 PM, ToddAndMargo via perl6-users wrote: > On Wed, Jan 2, 2019 at 8:41 PM ToddAndMargo via perl6-users > wrote: >> >> Hi All, >> >> Looking at >> >>  https://docs.perl6.org/routine/print >> >> I see >>

Re: **@args question

2019-01-02 Thread ToddAndMargo via perl6-users
> On Wed, Jan 2, 2019 at 8:41 PM ToddAndMargo via perl6-users > wrote: >> >> Hi All, >> >> Looking at >> >> https://docs.perl6.org/routine/print >> >> I see >> >> multi sub print(**@args --> True) >> >> Qu

Re: **@args question

2019-01-02 Thread Brad Gilbert
d them. On Wed, Jan 2, 2019 at 8:41 PM ToddAndMargo via perl6-users wrote: > > Hi All, > > Looking at > > https://docs.perl6.org/routine/print > > I see > > multi sub print(**@args --> True) > > Question. If I wanted to create my own print routine

**@args question

2019-01-02 Thread ToddAndMargo via perl6-users
Hi All, Looking at https://docs.perl6.org/routine/print I see multi sub print(**@args --> True) Question. If I wanted to create my own print routine using **@args, how would I declare it? sub printx( **@args data ) {...} Many thanks,

Re: Basic question about lexical binding in relationship with "list assignment"

2019-01-02 Thread Elizabeth Mattijsen
Fixed with https://github.com/rakudo/rakudo/commit/23663609a7 > On 27 Dec 2018, at 09:29, Raymond Dresens wrote: > > Hello, > > I'm getting up to speed with Perl 6 again after a long while, and I more > or less 'hit my nose' against something that I can reduce to the > following very basic

Re: Basic question about lexical binding in relationship with "list assignment"

2018-12-27 Thread Elizabeth Mattijsen
I’d say it is a bug you do not get the error with “my ($foo) = 6”, as clearly the first “say $foo” inside the scope is referring to the inner $foo, not the outer $foo. So I’d suggest filing an issue for that: https://github.com/rakudo/rakudo/issues > On 27 Dec 2018, at 09:29, Raymond Dresens

Re: Basic question about lexical binding in relationship with "list assignment"

2018-12-27 Thread JJ Merelo
Hi, El jue., 27 dic. 2018 a las 9:30, Raymond Dresens (< raymond.dres...@gmail.com>) escribió: > Hello, > > I'm getting up to speed with Perl 6 again after a long while, and I more > or less 'hit my nose' against something that I can reduce to the > following very basic snippet of code: > >

Basic question about lexical binding in relationship with "list assignment"

2018-12-27 Thread Raymond Dresens
Hello, I'm getting up to speed with Perl 6 again after a long while, and I more or less 'hit my nose' against something that I can reduce to the following very basic snippet of code: my $foo = 3; say $foo; { say $foo; my $foo = 6; say $foo; } This will

Re: say Cool-concat-junction question

2018-12-24 Thread yary
Dumped this to https://github.com/rakudo/rakudo/issues/2568 -y

Re: say Cool-concat-junction question

2018-12-23 Thread Brad Gilbert
I am sure about that :<~>.cando(\(3,('a'|'b'))».signature.say # ((*@args --> Str:D)) :<~>.cando(\('x',('a'|'b')))».signature.say # ((Str:D $a, Junction:D $b) (*@args --> Str:D)) Since there is a Junction candidate (or rather three), there is probably a reason for it. Also if you turn the 3 into

Re: say Cool-concat-junction question

2018-12-23 Thread yary
Thanks for this explanation El dom., 23 dic. 2018 a las 7:39, Brad Gilbert () escribió: > turns out there is a candidate for > > Str:D, Junction:D > > but not for > > Any:D, Junction:D ... An improvement would be to change the "Str:D, Junction:D" candidate on concatenation to the coercion

Re: say Cool-concat-junction question

2018-12-23 Thread JJ Merelo
El dom., 23 dic. 2018 a las 7:39, Brad Gilbert () escribió: > I turns out there is a candidate for > > Str:D, Junction:D > > but not for > > Any:D, Junction:D > > so it is going through one of the other :<~> candidates, > specifically it looks like it could be > > *@args > > Which doesn't

Re: say Cool-concat-junction question

2018-12-22 Thread Brad Gilbert
I turns out there is a candidate for Str:D, Junction:D but not for Any:D, Junction:D so it is going through one of the other :<~> candidates, specifically it looks like it could be *@args Which doesn't apparently work with Junctions. So yes it is a bug. On Sat, Dec 22, 2018 at 9:05 PM yary

say Cool-concat-junction question

2018-12-22 Thread yary
What's going on here- is this error a mistake on my part, or a bug? $ perl6 -e "say 3 ~ ( 'a' | 'b' )" Type check failed for return value; expected Str:D but got Junction (any("3a", "3b")) in block at -e line 1 $ perl6 -e "say 'x' ~ ( 'a' | 'b' )" any(xa, xb) $ perl6 -v This is Rakudo

Re: KEEP/UNDO phaser question

2018-10-28 Thread Elizabeth Mattijsen
> On 28 Oct 2018, at 01:51, Norman Gaywood wrote: > Just been reading the latest of Elizabeth's wonderful blog posts on how > phasers work in perl6: > https://opensource.com/article/18/10/how-phasers-work-perl-6 > > I have question on the KEEP/UNDO example: > { &

KEEP/UNDO phaser question

2018-10-27 Thread Norman Gaywood
Just been reading the latest of Elizabeth's wonderful blog posts on how phasers work in perl6: https://opensource.com/article/18/10/how-phasers-work-perl-6?fbclid=IwAR3eJSn5EdJh2DYgpjrFOy7kg-dShuilwQhHDHTANeb4JmHYSBiTz3WyxPA I have question on the KEEP/UNDO example: { KEEP $dbh.commit

Re: routine declaration line question

2018-10-12 Thread Larry Wall
is evaluated in sink context because its value is known to be unwanted. In fact, if you *try* to return something in addition to what --> already returns, it'll question your sanity: > p6 'sub troo ( --> True ) { return False }' ===SORRY!=== Error while compiling -e No return argument

Re: routine declaration line question

2018-10-12 Thread Curt Tilmes
On Fri, Oct 12, 2018 at 8:46 AM Simon Proctor wrote: > What if something could return an Int or a Rat? Or an single item or an > Array? Having Mu or Any as the listed return type isn't very useful. > > Maybe better to define a subset for it. Or just leave it empty and > document it. > For an

Re: routine declaration line question

2018-10-12 Thread Simon Proctor
What if something could return an Int or a Rat? Or an single item or an Array? Having Mu or Any as the listed return type isn't very useful. Maybe better to define a subset for it. Or just leave it empty and document it. On Fri, 12 Oct 2018, 13:35 Curt Tilmes, wrote: > > On Fri, Oct 12, 2018

Re: routine declaration line question

2018-10-12 Thread Curt Tilmes
On Fri, Oct 12, 2018 at 7:46 AM Simon Proctor wrote: > Only if the routine has an easily defined return Type. Many do not. > Is there not always a common root, even if it is Mu? Why not explicitly mark those as Mu for documentation purposes at least? That would differentiate those from the

Re: routine declaration line question

2018-10-12 Thread Simon Proctor
mentation for routines does >> not give a --> and I find having to dig around to figure out what >> the return is to be time consuming and confusing. >> >> Based on what Larry stated, I do believe that the documentation >> should always have a --> in the definition li

Re: routine declaration line question

2018-10-12 Thread Curt Tilmes
nfusing. > > Based on what Larry stated, I do believe that the documentation > should always have a --> in the definition line. This was > my question, not whether or not I should write a definition > line for my own subs. > I agree. The documentation should always describe the routine with a --> Curt

Re: routine declaration line question

2018-10-12 Thread Todd Chester via perl6-users
the documentation should always have a --> in the definition line. This was my question, not whether or not I should write a definition line for my own subs. -T '"quick and dirty" programming', huh. I live and die by Top Down. You can't maintain "stream of conscience" programming. If y

Re: routine declaration line question

2018-10-12 Thread Curt Tilmes
On Fri, Oct 12, 2018 at 6:08 AM Todd Chester via perl6-users < perl6-users@perl.org> wrote: > > If nothing is being returned, it should really be indicated with --> Nil > > since that can enable certain optimizations. Similarly, if a routine > always > > returns true upon success, that can be

Re: routine declaration line question

2018-10-12 Thread Todd Chester via perl6-users
On 10/5/18 8:39 AM, Larry Wall wrote: On Thu, Oct 04, 2018 at 03:13:15PM -0400, Trey Harris wrote: : Right; that's what I meant by "stylistically" — a `--> Mu` can highlight : that something is being returned (and that side-effects are not the primary : purpose), while nothing indicates that

Re: routine declaration line question

2018-10-05 Thread Trey Harris
On Fri, Oct 5, 2018 at 2:10 PM Brandon Allbery wrote: > Haskell supports it via typeclass resolution, which is mostly a source of > confusion to newcomers who assume (read :: Read a => String -> a) must be > deciding what to produce based on the String because they're not expecting > return type

Re: routine declaration line question

2018-10-05 Thread Timo Paulssen
You're probably thinking of ;; in a signature. On 05/10/2018 20:02, Trey Harris wrote: > But right now we have a situation where “everything within the > signature /except for/ the return constraint can participate in multi > dispatch”, which does feel weird. But is that actually true? >

Re: routine declaration line question

2018-10-05 Thread Brandon Allbery
Haskell supports it via typeclass resolution, which is mostly a source of confusion to newcomers who assume (read :: Read a => String -> a) must be deciding what to produce based on the String because they're not expecting return type polymorphism. It doesn't seem to be a problem otherwise.

Re: routine declaration line question

2018-10-05 Thread Trey Harris
On Fri, Oct 5, 2018 at 1:13 PM Brandon Allbery wrote: > My problem with it being in the signature is still that it doesn't say > which part of the contract it applies to; it appears to be claiming it's > part of dispatch, when it's not. > Explicit argument polymorphism has been shown to be

Re: routine declaration line question

2018-10-05 Thread Brandon Allbery
My problem with it being in the signature is still that it doesn't say which part of the contract it applies to; it appears to be claiming it's part of dispatch, when it's not. On Fri, Oct 5, 2018 at 12:01 PM Larry Wall wrote: > On Thu, Oct 04, 2018 at 09:35:08PM +0200, JJ Merelo wrote: > : El

Re: routine declaration line question

2018-10-05 Thread JJ Merelo
Hi, El vie., 5 oct. 2018 a las 18:01, Larry Wall () escribió: > On Thu, Oct 04, 2018 at 09:35:08PM +0200, JJ Merelo wrote: > : El jue., 4 oct. 2018 21:21, Brandon Allbery > escribió: > : > : > I don't think we've reached the point of such conventions yet. And > there's > : > some history here,

Re: routine declaration line question

2018-10-05 Thread Larry Wall
On Thu, Oct 04, 2018 at 09:35:08PM +0200, JJ Merelo wrote: : El jue., 4 oct. 2018 21:21, Brandon Allbery escribió: : : > I don't think we've reached the point of such conventions yet. And there's : > some history here, in --> not having done anything in the early days except : > possibly slow

Re: routine declaration line question

2018-10-05 Thread Larry Wall
On Thu, Oct 04, 2018 at 03:13:15PM -0400, Trey Harris wrote: : Right; that's what I meant by "stylistically" — a `--> Mu` can highlight : that something is being returned (and that side-effects are not the primary : purpose), while nothing indicates that the return value, though it exists, : is

Re: routine declaration line question

2018-10-04 Thread Brandon Allbery
gt;>>>> whatever "falls off the end". (There's a bit of variance here as I'm >>>>>>>>> not >>>>>>>>> sure it's a convention everyone has followed.) It's equivalent to >>>>>>>>> "--> Mu" >

Re: routine declaration line question

2018-10-04 Thread JJ Merelo
;>>>>> sure it's a convention everyone has followed.) It's equivalent to "--> >>>>>>>> Mu" >>>>>>>> because anything that could "fall of the end" is Mu. >>>>>>>> >>>>>>

Re: routine declaration line question

2018-10-04 Thread Brandon Allbery
eans that it's not constrained to a type. It can still return >>>>>> something, but it can be anything. >>>>>> >>>>> >>>>> >>>>> I get all that, except for the "No" at the front. ;-) >>>>> >&g

Re: routine declaration line question

2018-10-04 Thread Trey Harris
quot;fall of the end" is Mu. >>>>>> >>>>> >>>>> No, it means that it's not constrained to a type. It can still return >>>>> something, but it can be anything. >>>>> >>>> >>>> >>>&

Re: routine declaration line question

2018-10-04 Thread ToddAndMargo
constraint. The programmer may not like using constraints at all and treats Perl 6 like Perl 5 in the respect of wanting arbitrarily mungible values. But the word "stylistically" was important, as I was responding to

Re: routine declaration line question

2018-10-04 Thread Brandon Allbery
gt;>> >>> I get all that, except for the "No" at the front. ;-) >>> >>> Or were you talking about the "not useful" bit? Yes, of course in any >>> given codebase, the lack of a return value has no more or less meaning than >>> a lack o

Re: routine declaration line question

2018-10-04 Thread JJ Merelo
El jue., 4 oct. 2018 a las 21:02, Trey Harris () escribió: > Ah (replying to both Brandon and JJ since their replies crossed): > > So `--> Mu` is not a sufficient and/or correct return constraint for > things like AT-POS because why, then? > It's totally OK. The "incorrect" part might be because

Re: routine declaration line question

2018-10-04 Thread ToddAndMargo
On 10/4/18 9:37 AM, Brandon Allbery wrote: Consider a function which returns the element at a given position in a list:     method AT-POS(\position) The only thing you can say about the result type is that it's whatever the type of the element at that position is. So it doesn't bother

Re: routine declaration line question

2018-10-04 Thread Trey Harris
codebase, the lack of a return value has no more or less meaning than >> a lack of any constraint. The programmer may not like using constraints at >> all and treats Perl 6 like Perl 5 in the respect of wanting arbitrarily >> mungible values. >> >> But the word "sty

Re: routine declaration line question

2018-10-04 Thread ToddAndMargo
On 10/4/18 1:49 AM, Peter Pentchev wrote: On Wed, Oct 03, 2018 at 10:50:14PM -0700, ToddAndMargo wrote: On Wed, Oct 3, 2018 at 7:21 PM ToddAndMargo mailto:toddandma...@zoho.com>> wrote: >> On 04/10/2018 03:07, ToddAndMargo wrote: >>> Hi All, >>> >>> In another

Re: routine declaration line question

2018-10-04 Thread Brandon Allbery
eaning than > a lack of any constraint. The programmer may not like using constraints at > all and treats Perl 6 like Perl 5 in the respect of wanting arbitrarily > mungible values. > > But the word "stylistically" was important, as I was responding to Todd's > question about th

Re: routine declaration line question

2018-10-04 Thread JJ Merelo
Hi El jue., 4 oct. 2018 a las 20:48, Trey Harris () escribió: > > > On Thu, Oct 4, 2018 at 02:13 JJ Merelo wrote: > >> >> >> El jue., 4 oct. 2018 a las 3:36, Trey Harris () escribió: >> >>> _All_ routines in Perl 6 return _something._ A lack of a "-->" simply >>> indicates stylistically that

Re: routine declaration line question

2018-10-04 Thread Trey Harris
less meaning than a lack of any constraint. The programmer may not like using constraints at all and treats Perl 6 like Perl 5 in the respect of wanting arbitrarily mungible values. But the word "stylistically" was important, as I was responding to Todd's question about the docs—I think a lac

Re: routine declaration line question

2018-10-04 Thread Brandon Allbery
Consider a function which returns the element at a given position in a list: method AT-POS(\position) The only thing you can say about the result type is that it's whatever the type of the element at that position is. So it doesn't bother specifying a type at all, because the prototype can't

Re: routine declaration line question

2018-10-04 Thread Peter Pentchev
On Wed, Oct 03, 2018 at 10:50:14PM -0700, ToddAndMargo wrote: > > > > > > > > On Wed, Oct 3, 2018 at 7:21 PM ToddAndMargo > > > > > wrote: > > > > > > > > > > >> On 04/10/2018 03:07, ToddAndMargo wrote: > > > > > >>> Hi All, > > > > > >>> > > > >

Re: routine declaration line question

2018-10-04 Thread JJ Merelo
El jue., 4 oct. 2018 a las 4:53, Trey Harris () escribió: > > On Wed, Oct 3, 2018 at 22:21 ToddAndMargo wrote: > >> >> On 04/10/2018 03:07, ToddAndMargo wrote: >> >>> Hi All, >> >>> >> >>> In another thread, Timo wrote me: >> >>> >> >>> The "-->" part of the signature is optional. If

Re: routine declaration line question

2018-10-04 Thread JJ Merelo
El jue., 4 oct. 2018 a las 3:36, Trey Harris () escribió: > _All_ routines in Perl 6 return _something._ A lack of a "-->" simply > indicates stylistically that the return is not useful because it's whatever > "falls off the end". (There's a bit of variance here as I'm not sure it's a >

Re: routine declaration line question

2018-10-03 Thread ToddAndMargo
On Wed, Oct 3, 2018 at 7:21 PM ToddAndMargo mailto:toddandma...@zoho.com>> wrote: >> On 04/10/2018 03:07, ToddAndMargo wrote: >>> Hi All, >>> >>> In another thread, Timo wrote me: >>> >>> The "-->" part of the signature is optional. If there isn't

Re: routine declaration line question

2018-10-03 Thread Brad Gilbert
If a routine does not declare it's return type, absolutely anything can be returned. One reason may be that its return value isn't really useful. It could be that the writer didn't think to declare it. (or didn't want to) Another possibility is that the potential returned values are of many

Re: routine declaration line question

2018-10-03 Thread ToddAndMargo
On Wed, Oct 3, 2018 at 7:21 PM ToddAndMargo > wrote: >> On 04/10/2018 03:07, ToddAndMargo wrote: >>> Hi All, >>> >>> In another thread, Timo wrote me: >>> >>> The "-->" part of the signature is optional. If there isn't >>>

Re: routine declaration line question

2018-10-03 Thread ToddAndMargo
On 10/3/18 7:53 PM, Trey Harris wrote: On Wed, Oct 3, 2018 at 22:21 ToddAndMargo > wrote: >> On 04/10/2018 03:07, ToddAndMargo wrote: >>> Hi All, >>> >>> In another thread, Timo wrote me: >>> >>>         The "-->" part of the

Re: routine declaration line question

2018-10-03 Thread yary
> And not all subs return things, like "say" and "print". say and print return true if the print succeeded, just like in perl 5. > say say "hi"; hi True Useful if printing to a filehandle, and the file you're writing to is on a volume that fills up. Or a network drive that goes away. You do

Re: routine declaration line question

2018-10-03 Thread Trey Harris
On Wed, Oct 3, 2018 at 22:21 ToddAndMargo wrote: > >> On 04/10/2018 03:07, ToddAndMargo wrote: > >>> Hi All, > >>> > >>> In another thread, Timo wrote me: > >>> > >>> The "-->" part of the signature is optional. If there isn't > >>> one, it defaults to Mu, which is the type that

Re: routine declaration line question

2018-10-03 Thread ToddAndMargo
On 04/10/2018 03:07, ToddAndMargo wrote: Hi All, In another thread, Timo wrote me: The "-->" part of the signature is optional. If there isn't one, it defaults to Mu, which is the type that everything conforms to, i.e. the sub or method that either has "--> Mu"

Re: routine declaration line question

2018-10-03 Thread Timo Paulssen
I just spotted a grave mistake in my earlier mail: the --> constraints are validated at *run* time, not *compile* time; that's a very big difference, and an important one. Of course "every time a sub or method returns" doesn't make much sense if i had meant "compile time", but I felt i should

Re: routine declaration line question

2018-10-03 Thread Trey Harris
_All_ routines in Perl 6 return _something._ A lack of a "-->" simply indicates stylistically that the return is not useful because it's whatever "falls off the end". (There's a bit of variance here as I'm not sure it's a convention everyone has followed.) It's equivalent to "--> Mu" because

Re: routine declaration line question

2018-10-03 Thread Brandon Allbery
Perl 6 routines always return *something*; if you don't return anything explicitly, it will return the result of the last statement/expression, or Mu as a last resort. (Mu is the "least defined value" in Perl 6. Any is somewhat more common, but is slightly more defined since it can participate in

routine declaration line question

2018-10-03 Thread ToddAndMargo
Hi All, In another thread, Timo wrote me: The "-->" part of the signature is optional. If there isn't one, it defaults to Mu, which is the type that everything conforms to, i.e. the sub or method that either has "--> Mu" explicitly, or has it by leaving it out, may

Re: Package Compile Question

2018-10-01 Thread Brad Gilbert
`Foo::Bar::<$quux>` is basically short for `::Foo::Bar::('$quux')` (except the former is looked up at compile time) So the way to do this is: my $bar = 'Bar'; ::Foo::( $bar ~ '::$quux' ) or ::Foo::($bar)::('$quux') Note that the leading `::` are necessary for dynamic lookups.

Re: Package Compile Question

2018-10-01 Thread JJ Merelo
El lun., 1 oct. 2018 a las 13:47, Richard Hogaboom (< richard.hogab...@gmail.com>) escribió: > Hmm... the ($bar) in Foo::($bar)::<$quux>; is an interpolation, but the > <$quux> is just another way of writing $Foo::($bar)::quux;, not an > interpolation, no? > > Right. It kinda is, but it should

Re: Package Compile Question

2018-10-01 Thread Richard Hogaboom
Hmm...  the ($bar) in Foo::($bar)::<$quux>; is an interpolation, but the <$quux> is just another way of writing $Foo::($bar)::quux;, not an interpolation, no? On 10/1/18 7:41 AM, JJ Merelo wrote: Thanks. I'll fix that. WRT the original post, it looks like it should work, but apparently

Re: Package Compile Question

2018-10-01 Thread JJ Merelo
Thanks. I'll fix that. WRT the original post, it looks like it should work, but apparently can't. The error should be selfexplanatory. Either you interpolate using :: or <>, but not both... JJ El lun., 1 oct. 2018 a las 13:38, Richard Hogaboom (< richard.hogab...@gmail.com>) escribió: > Not

Re: Package Compile Question

2018-10-01 Thread Richard Hogaboom
Not exactly, but close.  The following line is exactly from the doc.  It works.  It it works, then the offending(next line) line should work as well. my$bar='Bar'; say$Foo::($bar)::quux; # compound identifiers with interpolations; OUTPUT: «42␤» sayFoo::($bar)::<$quux>; # won't compile -

Re: Package Compile Question

2018-09-30 Thread JJ Merelo
Is that taken verbatim from the docs? I'll create an issue if that's the case. JJ

Package Compile Question

2018-09-30 Thread Richard Hogaboom
This does not compile; I think it should: use v6; class Foo {     class Bar {     our $quux = 42;     } } say $Foo::Bar::quux;  # works - 42 say Foo::Bar::<$quux>;  # works - 42 my $bar = 'Bar'; say $Foo::($bar)::quux;  # works - 42 # shouldn't this work too? say Foo::($bar)::<$quux>;  #

Re: words[] question

2018-09-26 Thread Brandon Allbery
We really are not communicating at all, are we? It says "--> Positional". Positional is a role specifying what to do with []. Positional is what knows what to do with [], so words() and lines() and everything else that produces a Positional doesn't have to know that. This is more or less the

Re: words[] question

2018-09-26 Thread ToddAndMargo
On 9/26/18 2:40 PM, Brandon Allbery wrote: Do you really think every function that produces a "list" has built into it secret knowledge of how you would index a list? They just produce a "Positional" or "Seq" or "List", etc. and *those* know what to do with []. The function doesn't even need

Re: words[] question

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:04 AM, Brian Duggan wrote: On Tuesday, September 25, Todd Chester wrote: Not to ask too obvious a question, but why does words use a [] instead of a () ? ... I am confused as to when to use [] and when to use () with a method. If a method is called without arguments, the () can

Re: words[] question

2018-09-26 Thread Brandon Allbery
hich category the grammar engine is expecting > > is critical to understanding any version of Perl, whether 5 or 6. > > You can't adequately describe any random syntax in Perl without first > > nailing down which of the main grammar rules is going to be parsing it. &g

Re: words[] question

2018-09-26 Thread ToddAndMargo
enough. :) Larry Hi Larry, Wonderful explanation! Thank you! Followup question. I am confused. How did they get from multi method words(Str:D $input: $limit = Inf --> Positional) to what goes in the () and what goes in the []? And why are they using the term "$limit&

Re: words[] question

2018-09-26 Thread Larry Wall
On Wed, Sep 26, 2018 at 01:16:26PM -0400, Parrot Raiser wrote: : Would it be correct to say: : [ ] aka square brackets, always surround the subscript of an array or : list, i.e. here "n: is an integer, [n] always means the nth item, : while : ( ), round brackets or parentheses, separate and

Re: words[] question

2018-09-26 Thread Parrot Raiser
calls, surrounding the argument list, if any? On 9/26/18, Brian Duggan wrote: > On Tuesday, September 25, Todd Chester wrote: >> Not to ask too obvious a question, but why does words use a [] >> instead of a () ? >> ... >> I am confused as to when to use [] and when to use (

Re: words[] question

2018-09-26 Thread Brian Duggan
On Tuesday, September 25, Todd Chester wrote: > Not to ask too obvious a question, but why does words use a [] > instead of a () ? > ... > I am confused as to when to use [] and when to use () with a method. If a method is called without arguments, the () can be omitted. &

Re: words[] question

2018-09-26 Thread Todd Chester
On 09/25/2018 11:37 PM, Todd Chester wrote: How about my `Str:D $input:` question? That chat line just told me it is an optional way of writing it. I like it!

Re: words[] question

2018-09-26 Thread Todd Chester
a...@zoho.com>>>) escribió: >> >> Hi All, >> >> https://docs.perl6.org/routine/words >> is no help >> >> Not to ask too obvious a question, but why does words use a [] >> instead of a () ? On 09/

  1   2   3   >