Re: Nil ?

2018-09-13 Thread Todd Chester




On 09/13/2018 02:24 PM, Elizabeth Mattijsen wrote:

On 13 Sep 2018, at 23:21, ToddAndMargo  wrote:



$ p6 'my $x="\na\nb\nc\n"; for ( split "\n", $x ) -> $i {print "<$i>\n"};'
<>



<>

with beginning and ending new lines.


FWIW, a more Perl6ish way would be:

$ p6 'my $x="\na\nb\nc\n"; for $x.lines -> $i {print "<$i>\n"};'



That is pretty looking.  Thank you!


Re: Nil ?

2018-09-13 Thread Elizabeth Mattijsen
> On 13 Sep 2018, at 23:21, ToddAndMargo  wrote:
> On 09/13/2018 12:29 PM, Elizabeth Mattijsen wrote:
>>> On 13 Sep 2018, at 20:47, ToddAndMargo  wrote:
>>> On 09/12/2018 10:09 AM, Larry Wall wrote:
>>>> Basically, ignore any advice to treat Nil as a normal value, because
>>>> it really is intended to represent the *absence* of a value as much as
>>>> possible.  It's a bit like the way solid-state electronics treats "holes"
>>>> as if they were real particles, and gets away with it much of the time.
>>>> But not all the time, because the hole isn't real; it's the collective
>>>> behavior of everything around a thing that's missing.
>>>> So while you can test explicitly for Nil if you try hard enough, it's
>>>> better not to try at all, because lots of places internally are using
>>>> that Nil to select some kind of default behavior that might or might
>>>> not look like Nil afterwards.
>>>> It was probably a mistake to put Nil into the type hierarchy underneath
>>>> the Any type in the first place.  It's more of a concept type like
>>>> Junction, so probably belongs outside of Any, which sits the top of the
>>>> "normal" object hierarchy.
>>>> These types are deeply magical.  Whenever you find yourself trying to
>>>> use Nil or Junction as a normal value, you have to ask yourself whether
>>>> you're just Mickey Mouse falling into the Sorcerer's Apprentice trap.
>>>> Unless you're a wizard, with Nil and Junction it's better to cargo cult
>>>> a few common usages and stay the heck away the rest of the time.
>>>> Larry
>>> 
>>> Hi Larry,
>>> 
>>> Beautiful description!  Almost magical!  :-)
>>> 
>>> I will stick with .defined that you suggested in another
>>> thread.
>> Another way to deal with Nil is to use “with”, especially if you don’t need 
>> to do anything if the value is Nil:
>> with “foo”.index(“o”) -> $index {
>> say “Found at index $index”;
>> }
>> Documentation: 
>> https://docs.perl6.org/language/control#index-entry-control_flow_with_orwith_without-with%2C_orwith%2C_without
> 
> Where I typically have to deal with Nil's is when I
> am looping through something I read back from a system
> call.  I never thought much of it when I was using bash,
> but when you see the raw stuff ...
> 
> Not a Nil, but things read back and looped with split
> can be interesting too.
> 
> $ p6 'my $x="\na\nb\nc\n"; for ( split "\n", $x ) -> $i {print "<$i>\n"};'
> <>
> 
> 
> 
> <>
> 
> with beginning and ending new lines.

FWIW, a more Perl6ish way would be:

$ p6 'my $x="\na\nb\nc\n"; for $x.lines -> $i {print "<$i>\n"};'


Re: Nil ?

2018-09-13 Thread ToddAndMargo

On 09/13/2018 12:29 PM, Elizabeth Mattijsen wrote:

On 13 Sep 2018, at 20:47, ToddAndMargo  wrote:
On 09/12/2018 10:09 AM, Larry Wall wrote:

Basically, ignore any advice to treat Nil as a normal value, because
it really is intended to represent the *absence* of a value as much as
possible.  It's a bit like the way solid-state electronics treats "holes"
as if they were real particles, and gets away with it much of the time.
But not all the time, because the hole isn't real; it's the collective
behavior of everything around a thing that's missing.
So while you can test explicitly for Nil if you try hard enough, it's
better not to try at all, because lots of places internally are using
that Nil to select some kind of default behavior that might or might
not look like Nil afterwards.
It was probably a mistake to put Nil into the type hierarchy underneath
the Any type in the first place.  It's more of a concept type like
Junction, so probably belongs outside of Any, which sits the top of the
"normal" object hierarchy.
These types are deeply magical.  Whenever you find yourself trying to
use Nil or Junction as a normal value, you have to ask yourself whether
you're just Mickey Mouse falling into the Sorcerer's Apprentice trap.
Unless you're a wizard, with Nil and Junction it's better to cargo cult
a few common usages and stay the heck away the rest of the time.
Larry


Hi Larry,

Beautiful description!  Almost magical!  :-)

I will stick with .defined that you suggested in another
thread.


Another way to deal with Nil is to use “with”, especially if you don’t need to 
do anything if the value is Nil:

with “foo”.index(“o”) -> $index {
 say “Found at index $index”;
}

Documentation: 
https://docs.perl6.org/language/control#index-entry-control_flow_with_orwith_without-with%2C_orwith%2C_without



Where I typically have to deal with Nil's is when I
am looping through something I read back from a system
call.  I never thought much of it when I was using bash,
but when you see the raw stuff ...

Not a Nil, but things read back and looped with split
can be interesting too.

$ p6 'my $x="\na\nb\nc\n"; for ( split "\n", $x ) -> $i {print "<$i>\n"};'
<>



<>

with beginning and ending new lines.


Re: Nil ?

2018-09-13 Thread Elizabeth Mattijsen
> On 13 Sep 2018, at 20:47, ToddAndMargo  wrote:
> On 09/12/2018 10:09 AM, Larry Wall wrote:
>> Basically, ignore any advice to treat Nil as a normal value, because
>> it really is intended to represent the *absence* of a value as much as
>> possible.  It's a bit like the way solid-state electronics treats "holes"
>> as if they were real particles, and gets away with it much of the time.
>> But not all the time, because the hole isn't real; it's the collective
>> behavior of everything around a thing that's missing.
>> So while you can test explicitly for Nil if you try hard enough, it's
>> better not to try at all, because lots of places internally are using
>> that Nil to select some kind of default behavior that might or might
>> not look like Nil afterwards.
>> It was probably a mistake to put Nil into the type hierarchy underneath
>> the Any type in the first place.  It's more of a concept type like
>> Junction, so probably belongs outside of Any, which sits the top of the
>> "normal" object hierarchy.
>> These types are deeply magical.  Whenever you find yourself trying to
>> use Nil or Junction as a normal value, you have to ask yourself whether
>> you're just Mickey Mouse falling into the Sorcerer's Apprentice trap.
>> Unless you're a wizard, with Nil and Junction it's better to cargo cult
>> a few common usages and stay the heck away the rest of the time.
>> Larry
> 
> Hi Larry,
> 
> Beautiful description!  Almost magical!  :-)
> 
> I will stick with .defined that you suggested in another
> thread.

Another way to deal with Nil is to use “with”, especially if you don’t need to 
do anything if the value is Nil:

with “foo”.index(“o”) -> $index {
say “Found at index $index”;
}

Documentation: 
https://docs.perl6.org/language/control#index-entry-control_flow_with_orwith_without-with%2C_orwith%2C_without

Re: Nil ?

2018-09-13 Thread ToddAndMargo

On 09/12/2018 10:09 AM, Larry Wall wrote:

Basically, ignore any advice to treat Nil as a normal value, because
it really is intended to represent the *absence* of a value as much as
possible.  It's a bit like the way solid-state electronics treats "holes"
as if they were real particles, and gets away with it much of the time.
But not all the time, because the hole isn't real; it's the collective
behavior of everything around a thing that's missing.

So while you can test explicitly for Nil if you try hard enough, it's
better not to try at all, because lots of places internally are using
that Nil to select some kind of default behavior that might or might
not look like Nil afterwards.

It was probably a mistake to put Nil into the type hierarchy underneath
the Any type in the first place.  It's more of a concept type like
Junction, so probably belongs outside of Any, which sits the top of the
"normal" object hierarchy.

These types are deeply magical.  Whenever you find yourself trying to
use Nil or Junction as a normal value, you have to ask yourself whether
you're just Mickey Mouse falling into the Sorcerer's Apprentice trap.
Unless you're a wizard, with Nil and Junction it's better to cargo cult
a few common usages and stay the heck away the rest of the time.

Larry



Hi Larry,

Beautiful description!  Almost magical!  :-)

I will stick with .defined that you suggested in another
thread.

Thank you!

-T

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: Nil ?

2018-09-12 Thread Larry Wall
Basically, ignore any advice to treat Nil as a normal value, because
it really is intended to represent the *absence* of a value as much as
possible.  It's a bit like the way solid-state electronics treats "holes"
as if they were real particles, and gets away with it much of the time.
But not all the time, because the hole isn't real; it's the collective
behavior of everything around a thing that's missing.

So while you can test explicitly for Nil if you try hard enough, it's
better not to try at all, because lots of places internally are using
that Nil to select some kind of default behavior that might or might
not look like Nil afterwards.

It was probably a mistake to put Nil into the type hierarchy underneath
the Any type in the first place.  It's more of a concept type like
Junction, so probably belongs outside of Any, which sits the top of the
"normal" object hierarchy.

These types are deeply magical.  Whenever you find yourself trying to
use Nil or Junction as a normal value, you have to ask yourself whether
you're just Mickey Mouse falling into the Sorcerer's Apprentice trap.
Unless you're a wizard, with Nil and Junction it's better to cargo cult
a few common usages and stay the heck away the rest of the time.

Larry


Re: Nil ?

2018-09-12 Thread JJ Merelo
When you assign Nil to a string or any object, it takes its default value.

Cheers



El mié., 12 sept. 2018 a las 10:23, Simon Proctor ()
escribió:

> O learn something new everyday :)
>
> On Wed, 12 Sep 2018 at 08:46 Elizabeth Mattijsen  wrote:
>
>> Also:
>>
>> my $a is default(Nil);
>>
>> > On 12 Sep 2018, at 09:25, Simon Proctor 
>> wrote:
>> >
>> > If you don't define the type of a Scalar and don't assign to it you'll
>> have an undefined Any (the Parent class of all the other types). If you
>> assign Nil to it then you have the same effect.
>> >
>> > You can make $x to be Nil by iether casting it : my Nil $x; or binding
>> it to Nil; my $x; $x := Nil;
>> >
>> > Basically Nil is special, slippery and a bit hard to catch.
>> >
>> >
>> >
>> > On Wed, 12 Sep 2018 at 06:56 ToddAndMargo 
>> wrote:
>> > What am, I missing?
>> >
>> > $ p6 'my $x; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
>> > Not Nil
>> >
>> > $ p6 'my $x = Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
>> > Not Nil
>> > --
>> > Simon Proctor
>> > Cognoscite aliquid novum cotidie
>>
> --
> Simon Proctor
> Cognoscite aliquid novum cotidie
>


-- 
JJ


Re: Nil ?

2018-09-12 Thread Simon Proctor
O learn something new everyday :)

On Wed, 12 Sep 2018 at 08:46 Elizabeth Mattijsen  wrote:

> Also:
>
> my $a is default(Nil);
>
> > On 12 Sep 2018, at 09:25, Simon Proctor  wrote:
> >
> > If you don't define the type of a Scalar and don't assign to it you'll
> have an undefined Any (the Parent class of all the other types). If you
> assign Nil to it then you have the same effect.
> >
> > You can make $x to be Nil by iether casting it : my Nil $x; or binding
> it to Nil; my $x; $x := Nil;
> >
> > Basically Nil is special, slippery and a bit hard to catch.
> >
> >
> >
> > On Wed, 12 Sep 2018 at 06:56 ToddAndMargo  wrote:
> > What am, I missing?
> >
> > $ p6 'my $x; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
> > Not Nil
> >
> > $ p6 'my $x = Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
> > Not Nil
> > --
> > Simon Proctor
> > Cognoscite aliquid novum cotidie
>
-- 
Simon Proctor
Cognoscite aliquid novum cotidie


Re: Nil ?

2018-09-12 Thread Elizabeth Mattijsen
Also:

my $a is default(Nil);

> On 12 Sep 2018, at 09:25, Simon Proctor  wrote:
> 
> If you don't define the type of a Scalar and don't assign to it you'll have 
> an undefined Any (the Parent class of all the other types). If you assign Nil 
> to it then you have the same effect. 
> 
> You can make $x to be Nil by iether casting it : my Nil $x; or binding it to 
> Nil; my $x; $x := Nil; 
> 
> Basically Nil is special, slippery and a bit hard to catch.
> 
> 
> 
> On Wed, 12 Sep 2018 at 06:56 ToddAndMargo  wrote:
> What am, I missing?
> 
> $ p6 'my $x; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
> Not Nil
> 
> $ p6 'my $x = Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
> Not Nil
> -- 
> Simon Proctor
> Cognoscite aliquid novum cotidie


Re: Nil ?

2018-09-12 Thread Simon Proctor
If you don't define the type of a Scalar and don't assign to it you'll have
an undefined Any (the Parent class of all the other types). If you assign
Nil to it then you have the same effect.

You can make $x to be Nil by iether casting it : my Nil $x; or binding it
to Nil; my $x; $x := Nil;

Basically Nil is special, slippery and a bit hard to catch.



On Wed, 12 Sep 2018 at 06:56 ToddAndMargo  wrote:

> What am, I missing?
>
> $ p6 'my $x; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
> Not Nil
>
> $ p6 'my $x = Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
> Not Nil
>
-- 
Simon Proctor
Cognoscite aliquid novum cotidie


Nil ?

2018-09-11 Thread ToddAndMargo

What am, I missing?

$ p6 'my $x; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
Not Nil

$ p6 'my $x = Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
Not Nil


Re: nil mystery

2018-04-30 Thread ToddAndMargo

On 04/30/2018 05:20 PM, Andrew Kirkpatrick wrote:

I couldn't
reproduce this by assigning Nil to a variable



Well as it transpires, when I tested the {$x} version, I
forgot to press "save".  Also, a one liner operated
differently than a program.  And to top things off,
when reading "this" data back from the secondary clipboard,
a nil got stuck at the end of the string.

I use ${x} a lot in bash and Perl5, so {$x} in Perl6
is my preference too.

Good times!


Re: nil mystery

2018-04-30 Thread Andrew Kirkpatrick
The original error you quoted was about use of Nil. I couldn't
reproduce this by assigning Nil to a variable, turns out that's
because such an assignment is specified to set the variable to the
default value of the type of the variable. my $x = Nil gives (Any), my
Str $y = Nil gives (Str), and only my Nil $z = Nil actually gives Nil.
In your more complete code snippet it looks like the $Line ~~ match
fails, leaving $0 with the value Nil, leading to the error you first
posted.

I think Patrick is right that using braces to control interpolation is
a good idea.

On 30 April 2018 at 21:21, ToddAndMargo <toddandma...@zoho.com> wrote:
>
>> On Sun, Apr 29, 2018 at 10:20:48PM -0700, ToddAndMargo wrote:
>>>
>>> On 04/29/2018 10:12 PM, ToddAndMargo wrote:
>>>>
>>>> On 04/29/2018 09:32 PM, Andrew Kirkpatrick wrote:
>>>>>
>>>>> There is not enough context to answer or even reproduce the problem -
>>>>> how are the variables declared and what values do they have just prior
>>>>> to this line?
>>>
>>>
>>> Some simpler examples:
>>>
>>> $ perl6 -e 'my $x="abcde"; say $x;'
>>> abcde
>>>
>>> $ perl6 -e 'my $x="abcde"; my $y="$x" ~ ""; say $y;'
>>> abcde
>>>
>>> $ perl6 -e 'my $x="abcde"; my $y="$x"; say $y;'
>>> Type Str does not support associative indexing.
>>> in block  at -e line 1
>>>
>>> $ perl6 -e 'my $x="abcde"; my $y="{$x}"; say $y;'
>>> abcde
>>>
>>> $ perl6 -e 'my $x="abcde"; my $y="$x\<br\>"; say $y;'
>>> abcde
>>>
>>>
>>> So when is "<" and ">" a letter and when is it a redirect?
>>
>>
>
>
> On 04/30/2018 12:09 AM, Patrick Spek wrote:
>> It seems like in the one case it throws an error, it's because `<>` are
>> being
>> used to index a hash. Or at least tried to. In Perl 6, you can access a
>> Hash's
>> elements using `%foo`, which will access the index `bar` on the Hash
>> `%foo`.
>>
>> The other cases are explicitly not referring to a variable, or have
>> delimiters
>> in place to make it known to the compiler that you're not trying to access
>> a
>> Hash index.
>>
>> The error you're getting is "Type Str does not support associative
>> indexing.",
>> which is correct, though perhaps a little unexpected for you. `$x`
>> contains a
>> Str, not a Hash, but the `` still try to retrieve the index `br` from
>> it.
>> The solution is to use any of the other options you're using, with my
>> personal
>> preference going out to `{$x}`.
>>
>
>
> Hi Patrick,
>
> Now it makes sense.  It was trying to resolve a hash.
>
> Thank you!
>
> -T
>
> --
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~


Re: nil mystery

2018-04-30 Thread ToddAndMargo



On Sun, Apr 29, 2018 at 10:20:48PM -0700, ToddAndMargo wrote:

On 04/29/2018 10:12 PM, ToddAndMargo wrote:

On 04/29/2018 09:32 PM, Andrew Kirkpatrick wrote:

There is not enough context to answer or even reproduce the problem -
how are the variables declared and what values do they have just prior
to this line?


Some simpler examples:

$ perl6 -e 'my $x="abcde"; say $x;'
abcde

$ perl6 -e 'my $x="abcde"; my $y="$x" ~ ""; say $y;'
abcde

$ perl6 -e 'my $x="abcde"; my $y="$x"; say $y;'
Type Str does not support associative indexing.
in block  at -e line 1

$ perl6 -e 'my $x="abcde"; my $y="{$x}"; say $y;'
abcde

$ perl6 -e 'my $x="abcde"; my $y="$x\"; say $y;'
abcde


So when is "<" and ">" a letter and when is it a redirect?





On 04/30/2018 12:09 AM, Patrick Spek wrote:
> It seems like in the one case it throws an error, it's because `<>` 
are being
> used to index a hash. Or at least tried to. In Perl 6, you can access 
a Hash's

> elements using `%foo`, which will access the index `bar` on the Hash
> `%foo`.
>
> The other cases are explicitly not referring to a variable, or have 
delimiters
> in place to make it known to the compiler that you're not trying to 
access a

> Hash index.
>
> The error you're getting is "Type Str does not support associative 
indexing.",
> which is correct, though perhaps a little unexpected for you. `$x` 
contains a
> Str, not a Hash, but the `` still try to retrieve the index `br` 
from it.
> The solution is to use any of the other options you're using, with my 
personal

> preference going out to `{$x}`.
>


Hi Patrick,

Now it makes sense.  It was trying to resolve a hash.

Thank you!

-T

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: nil mystery

2018-04-29 Thread ToddAndMargo

On 04/29/2018 10:12 PM, ToddAndMargo wrote:

On 04/29/2018 09:32 PM, Andrew Kirkpatrick wrote:

There is not enough context to answer or even reproduce the problem -
how are the variables declared and what values do they have just prior
to this line?


Some simpler examples:

$ perl6 -e 'my $x="abcde"; say $x;'
abcde

$ perl6 -e 'my $x="abcde"; my $y="$x" ~ ""; say $y;'
abcde

$ perl6 -e 'my $x="abcde"; my $y="$x"; say $y;'
Type Str does not support associative indexing.
  in block  at -e line 1

$ perl6 -e 'my $x="abcde"; my $y="{$x}"; say $y;'
abcde

$ perl6 -e 'my $x="abcde"; my $y="$x\"; say $y;'
abcde


So when is "<" and ">" a letter and when is it a redirect?


Re: nil mystery

2018-04-29 Thread ToddAndMargo

On 04/29/2018 09:32 PM, Andrew Kirkpatrick wrote:

There is not enough context to answer or even reproduce the problem -
how are the variables declared and what values do they have just prior
to this line? Also, what version of rakudo?

On 30 April 2018 at 11:29, ToddAndMargo <toddandma...@zoho.com> wrote:

Hi All,

These two throw an operating on a "Nil" error:
 $PartsStr ~= "$PartNo";
 $PartsStr ~= "{$PartNo}";


But this does not:
 $PartsStr ~= "{$PartNo}" ~ "";


And this does not either:
 $PartsStr ~= "abcde";

Huh?


Many thanks,
-T



$ perl6 -v
This is Rakudo version 2018.02.1 built on MoarVM version 2018.02
implementing Perl 6.c.



sub TransferParts() {
my $ClipStr;
my $PartNo;
my $Description;
my $Qty;
my $ItemPrice;

$ClipStr = ReadSecondaryClipboard();
# PrintRed( "$ClipStr\n" );
# for split( '', $ClipStr ) -> $Char { say "$Char = <", ord( $Char 
), ">"  };


$ClipStr ~~ s:global/ ord( 10 )/"\n"/;
for split( "\n", $ClipStr ) -> $Line {
if not $Line { last };
# PrintBlue( "<$Line>\n" );
# for split( '', $Line ) -> $Char { say "$Char = <", ord( $Char 
), ">"  }; say "\n\n";


$Line ~~ m/(.*?)\t(.*?)\t(.*?)\t(.*)/;
$PartNo  = $0;
$Description = $1;
$Qty = $2;
$ItemPrice   = $3;
#  PrintBlue( "PartNo <$PartNo>\nDescription 
<$Description>\nQty <$Qty>\nItemPrice <$ItemPrice>\n\n" );


$PartsStr ~= "{$PartNo}" ~ "";
$PartsStr ~= "{$Description}" ~ "";
if $Qty > 1 { $PartsStr ~= "" };
$PartsStr ~= "Qty = {$Qty}" ~ "";
if $Qty > 1 { $PartsStr ~= "" };
$PartsStr ~= "Item Price   ~{$ItemPrice}" ~ "";
$PartsStr ~= "";
}
}



Re: nil mystery

2018-04-29 Thread Andrew Kirkpatrick
There is not enough context to answer or even reproduce the problem -
how are the variables declared and what values do they have just prior
to this line? Also, what version of rakudo?

On 30 April 2018 at 11:29, ToddAndMargo <toddandma...@zoho.com> wrote:
> Hi All,
>
> These two throw an operating on a "Nil" error:
> $PartsStr ~= "$PartNo";
> $PartsStr ~= "{$PartNo}";
>
>
> But this does not:
> $PartsStr ~= "{$PartNo}" ~ "";
>
>
> And this does not either:
> $PartsStr ~= "abcde";
>
> Huh?
>
>
> Many thanks,
> -T
>
> --
> ~~~
> Serious error.
> All shortcuts have disappeared.
> Screen. Mind. Both are blank.
> ~~~


nil mystery

2018-04-29 Thread ToddAndMargo

Hi All,

These two throw an operating on a "Nil" error:
$PartsStr ~= "$PartNo";
$PartsStr ~= "{$PartNo}";


But this does not:
$PartsStr ~= "{$PartNo}" ~ "";


And this does not either:
$PartsStr ~= "abcde";

Huh?


Many thanks,
-T

--
~~~
Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.
~~~


Re: zef install Linenoise: Use of Nil in string context, (Linenoise) line 15

2018-04-26 Thread ToddAndMargo

On 04/26/2018 12:45 AM, mimosinnet wrote:

El Wednesday, 25 de April del 2018 a les 18:31, Todd Chester va escriure:


On 04/24/2018 11:30 AM, mimosinnet wrote:

This message appears when installing Linenoise

<---
$ zef install Linenoise
===> Installing: Linenoise:ver<0.1.1>:auth
Use of Nil in string context
  in block  at home#sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9
(Linenoise) line 15
--->


When I get a tough one, this "sometimes"  (watch the weasel word)
works.

Go to https://github.com/hoelzro/p6-linenoise and download Linenoise
and download Linenoise.

From inside the root of the Linesnoise director, try
 $ zef install .


Todd,

Thanks for the answer! Unfortunately, I get the same outcome:

$ zef install .
===> Testing [OK] for Linenoise:ver<0.1.1>:auth
===> Installing: Linenoise:ver<0.1.1>:auth
Use of Nil in string context
  in block  at home#sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9 
(Linenoise) line 15


Cheers!



Try asking the guys over on the Chat page.  Often times there are
bugs in the modules and they are good about getting them
fixed or coming up with workaround.

https://docs.perl6.org/webchat.html

Remember to tell them your version of Perl


Re: zef install Linenoise: Use of Nil in string context, (Linenoise) line 15

2018-04-26 Thread mimosinnet

El Wednesday, 25 de April del 2018 a les 18:31, Todd Chester va escriure:


On 04/24/2018 11:30 AM, mimosinnet wrote:

This message appears when installing Linenoise

<---
$ zef install Linenoise
===> Installing: Linenoise:ver<0.1.1>:auth
Use of Nil in string context
  in block  at home#sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9
(Linenoise) line 15
--->


When I get a tough one, this "sometimes"  (watch the weasel word)
works.

Go to https://github.com/hoelzro/p6-linenoise and download Linenoise
and download Linenoise.

From inside the root of the Linesnoise director, try
 $ zef install .


Todd,

Thanks for the answer! Unfortunately, I get the same outcome:

$ zef install .
===> Testing [OK] for Linenoise:ver<0.1.1>:auth
===> Installing: Linenoise:ver<0.1.1>:auth
Use of Nil in string context
 in block  at home#sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9 (Linenoise) 
line 15

Cheers! 


--
(≧∇≦) Mimosinnet (Linux User: #463211)

(≧∇≦) Ningún Lugar

★ Activisme Cultural per a la Transformació Social

(≧∇≦) Fractalitats en Investigació Crítica

* Investigació Crítica per a la Transformació Social
* http://psicologiasocial.uab.es/fic


Re: zef install Linenoise: Use of Nil in string context, (Linenoise) line 15

2018-04-25 Thread Todd Chester

On 04/24/2018 11:30 AM, mimosinnet wrote:

This message appears when installing Linenoise

<---
$ zef install Linenoise
===> Installing: Linenoise:ver<0.1.1>:auth
Use of Nil in string context
  in block  at home#sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9 
(Linenoise) line 15

--->

The above mentioned line is:

<---
$ sed -n '15p' .perl6/sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9

my constant LIBLINENOISE = %?RESOURCES.Str;
--->

This is a post on the %?RESOURCES variable:

https://hoelz.ro/blog/distributing-helper-libraries-with-perl6-modules

Nevertheless, I have fail to to solve this issue. Any hints appreciated.

Thanks!


P.D.: Perl6 info:
<---
$ perl6 -v
This is Rakudo version 2018.02 built on MoarVM version 2018.02
implementing Perl 6.c.
--->



Hi Mimosinnet,

When I get a tough one, this "sometimes"  (watch the weasel word)
works.

Go to https://github.com/hoelzro/p6-linenoise and download Linenoise
and download Linenoise.

From inside the root of the Linesnoise director, try
 $ zef install .

-T


zef install Linenoise: Use of Nil in string context, (Linenoise) line 15

2018-04-24 Thread mimosinnet

This message appears when installing Linenoise

<---
$ zef install Linenoise 


===> Installing: Linenoise:ver<0.1.1>:auth
Use of Nil in string context
 in block  at home#sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9 (Linenoise) 
line 15
--->

The above mentioned line is:

<---
$ sed -n '15p' .perl6/sources/0BDF8C54D33921FEA066491D8D13C96A7CB144B9

my constant LIBLINENOISE = %?RESOURCES.Str;
--->

This is a post on the %?RESOURCES variable:

https://hoelz.ro/blog/distributing-helper-libraries-with-perl6-modules

Nevertheless, I have fail to to solve this issue. Any hints appreciated.

Thanks!


P.D.: Perl6 info:
<---
$ perl6 -v 


This is Rakudo version 2018.02 built on MoarVM version 2018.02
implementing Perl 6.c.
--->

--
(≧∇≦) Mimosinnet (Linux User: #463211)


Re: Need help with Nil values

2016-02-23 Thread Lloyd Fournier
You could just do:

method new (Str $value?) { ... } # makes value optional

and then not pass anything to .new.

On Tue, Feb 23, 2016 at 1:27 PM TS xx <maringa...@hotmail.com> wrote:

> Thanks Brandon,
>
>
> That was what I was looking for.
>
> I'm trying it already.
>
>
> Regards,
>
> Emiliano
>
>
> --
> *From:* Brandon Allbery <allber...@gmail.com>
> *Sent:* Tuesday, February 23, 2016 2:21 AM
> *To:* TS xx
> *Cc:* perl6-users@perl.org
>
> *Subject:* Re: Need help with Nil values
> On Mon, Feb 22, 2016 at 9:15 PM, TS xx <maringa...@hotmail.com> wrote:
>
>> I expect $.value to hold Strings, but I want to be able to instantiate
>> MyClass whether I have a value already or not, and I also want to be able
>> to tell if $.value has a real String or not. Is this possible?
>
>
> You don't want Nil there; it's not the undefined value, it's a value of a
> special type. You want Str, the type object for Strings, which also serves
> as the undefined value (also true for other types). You can test it with
> `defined`.
>
> $myObject = MyClass.new(Str);
>
> then you can test $!value.defined or whatever.
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>


Re: Need help with Nil values

2016-02-22 Thread TS xx
Thanks,

That was it.
Somtimes I get confused with the way other languages treat undefined/null/nil 
values.

Regards,
Emiliano


From: Timo Paulssen <t...@wakelift.de>
Sent: Tuesday, February 23, 2016 2:20 AM
To: perl6-users@perl.org
Subject: Re: Need help with Nil values

Hello Emiliano,

In this case, I think you may want to use just "Str" instead of "Nil".
"Str" is the "type object" for Str objects, and you can check whether
it's a string like "foo" or just the Str object by checking $!value.defined.

There's a FAQ answer that's about "Any", but it works the same way for
"Str":

 http://doc.perl6.org/language/faq#What_is_%28Any%29%3F

And there's the classtut that talks about this a bit more in depth,
search for "type object":

 http://doc.perl6.org/language/classtut


I hope this'll get you towards your goal. If not, just keep asking :)

Have fun with Perl 6!
   - Timo



Re: Need help with Nil values

2016-02-22 Thread Brandon Allbery
On Mon, Feb 22, 2016 at 9:15 PM, TS xx <maringa...@hotmail.com> wrote:

> I expect $.value to hold Strings, but I want to be able to instantiate
> MyClass whether I have a value already or not, and I also want to be able
> to tell if $.value has a real String or not. Is this possible?


You don't want Nil there; it's not the undefined value, it's a value of a
special type. You want Str, the type object for Strings, which also serves
as the undefined value (also true for other types). You can test it with
`defined`.

$myObject = MyClass.new(Str);

then you can test $!value.defined or whatever.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need help with Nil values

2016-02-22 Thread Timo Paulssen

Hello Emiliano,

In this case, I think you may want to use just "Str" instead of "Nil". 
"Str" is the "type object" for Str objects, and you can check whether 
it's a string like "foo" or just the Str object by checking $!value.defined.


There's a FAQ answer that's about "Any", but it works the same way for 
"Str":


http://doc.perl6.org/language/faq#What_is_%28Any%29%3F

And there's the classtut that talks about this a bit more in depth, 
search for "type object":


http://doc.perl6.org/language/classtut


I hope this'll get you towards your goal. If not, just keep asking :)

Have fun with Perl 6!
  - Timo