develooper Front page | perl.perl6.users | Postings from June 2017

How do you call the variable types?

Thread Next
From:
Gabor Szabo
Date:
June 9, 2017 06:11
Subject:
How do you call the variable types?
Message ID:
CABe4FJCJy8E0c-3pvrLaXDyNaVSKrkBQCR59Uv2u=VwYy0_WSw@mail.gmail.com
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 @ always holds an array (@.^name is always Array or
some Array[type]). Similarly % always holds a hash and & is always a
function or a method.
So calling them array, hash, and function sounds good.

However I am not sure what to call the variables with a $ sigil?
Should they be called "scalars"? Wouldn't that case confusion as there
is also a container-type called Scalar.

The word "scalar" appears twice in the document describing the
variables: https://docs.perl6.org/language/variables and a total of
135 in the whole doc including the 5to6 documents and the document
describing the Scalar type.
The document describing the Scalar type:
https://docs.perl6.org/type/Scalar the term "$-sigiled variable" is
used which seems to be a bit long for general use.

So I wonder how do *you* call them?

Gabor

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About