> On 16 Jun 2017, at 06:23, Gabor Szabo wrote:
>
> On Sat, Jun 10, 2017 at 9:38 AM, Brent Laabs wrote:
>> I thought:
>> $ is Scalar
>> @ is Array
>> % is Hash
>> & is a function
>>
>
> Reading this https://docs.perl6.org/language/containers I just found
> out that a @-variable can also contai
On Sat, Jun 10, 2017 at 2:38 AM, Brent Laabs wrote:
> I thought:
> $ is Scalar
> @ is Array
> % is Hash
> & is a function
>
Pedantically:
$ forces item context, but otherwise allows any type (defaulting to
Scalar); the item context gets you "scalar" behavior in most cases even
with non-scalars
On Sat, Jun 10, 2017 at 9:38 AM, Brent Laabs wrote:
> I thought:
> $ is Scalar
> @ is Array
> % is Hash
> & is a function
>
Reading this https://docs.perl6.org/language/containers I just found
out that a @-variable can also contain a List,
not just an array:
> my @z = ()
[]
> @z.^name
Array
> my
I thought:
$ is Scalar
@ is Array
% is Hash
& is a function
> my $x; say $x.VAR.WHAT;
(Scalar)
A dollar variable is a scalar. The Scalar type is the the container for
the dollar-variables, just like Array is the container for @array and Hash
is the container for %hash. Of course we also have th
Brad, thanks for your reply.
I accept your point on not calling $-variables "generic variables",
but then how do you call them?
The same with the other 3. You described what they do in the same way
as the documentation does, but
when you casually speak about them, you know, with friends in bar :-)
@ does the Positional role
% does Associative
& does Callable
$ causes its value to be an item (its values do not flatten into an
outer list when you use `flat`)
my %hash is SetHash;
Array does Positional, and all of its values are itemized
We are unlikely to call $ variables "generic" becau
It also seems to me that 'scalar' gives the wrong impression compared to
arrays. A scalar in a vector is a component of a vector.
I was thinking of "generic".
Hence "$variable" is a generic variable because it can hold any type of
content.
On Friday, June 09, 2017 02:10 PM, Gabor Szabo wrot
Looking at https://docs.perl6.org/language/variables there are 4
variable types with sigil: $, @, %, &.
In Perl 5 I used to call them scalar, array, hash, and function
respectively, even if the scalar variable had a reference to an array
in it.
How do you call them in Perl 6?
As I understand @ a