Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl6 Builtin Types?

6 views
Skip to first unread message

Larry Wall

unread,
Oct 23, 2002, 2:40:40 PM10/23/02
to Michael Lazzaro, perl6-l...@perl.org
On Wed, 23 Oct 2002, Michael Lazzaro wrote:
: Where is the most definitive list of known Perl6 (not Parrot) builtin
: types?
:
: The following have been specified/implied by the A/Es:
:
: scalar
: bit (== bool? == boolean?)

We could always call them "umu", which is Japanese for yes/no. :-)

: num
: int
: str

Yes.

: bigint
: bignum

I think these just manifest as Num and Int, since the object types
will promote as necessary to big representations internally.

: bitarray (maybe)

No, that's just

my bit @array;

also known as

my @array returns bit;

also known as

my @array of bit;

also known as

my @array is Array of bit;

Note that "is" is the only way to specify the type of the variable
as opposed to what the variable contains.

"returns" is synonymous with "of", mostly so we can use "returns" on
subroutines, because "of" sounds weird:

my int sub foo () {...}
my sub foo () of int { ... }
my sub foo () returns int { ... }

More in A6...

: ref

Yes.

: rx (or regex,rule?)

That's Rule, I expect.

: code

Probably Code.

: classname

Probablly Class, which stringifies to a class name.

: Object

Yes, as new UNIVERSAL.

: array
: hash

Array and Hash. We reserve lowercase for "atomic" types.

: But also stated is that perl6 will have enough type information to
: easily interact with other languages, which implies to me that types
: must exist which, at minimum, mirror the C types (maybe by the same
: names, maybe not, maybe both)...
:
: int (char, long, short, whatever)
: int8
: int16
: int32
: int64
: uint
: uint8
: uint16
: uint32
: uint64
: float
: double (long double, etc?)
: cstr (null-terminated, non-Unicode-aware?)

Sure, why not? Might have to be long_double though. cstr might be assumed
if it's known you're passing a str to C. And num is probably double in
disguise.

: .... which wouldn't be used in typical programming, but would be needed
: to define signatures for things pulled in from other libraries?
:
: And perhaps
:
: bin
: oct
: hex
:
: should be builtin types subclassed from uint, but with overloaded
: (de)serialization such that:
:
: my int $i = 0x0a; print $i; # prints '10'
: my int $i = '0x0a'; print $i; # prints '0'
:
: my hex $i = 0x0a; print $i; # prints '0a'
: my hex $i = '0x0a'; print $i; # prints '0a'
: my hex $i = '0a'; print $i; # prints '0a'
:
: .... for helping with the variety of shell tools that Perl is so good at
: producing.

Hmm, maybe. Seems more like an interface shift than a type shift,
though. It's like "use the int type but wrap a hex interface
around it." This says to me that we need a method of specifying
that a given interface overrides methods from other base classes.
But this interface actually has an implementation somewhere. Hmm.

: What's the closest to a definitive list, so far?

Yours. :-)

But I'll try to remember to put a list into A6.

Larry

Michael Lazzaro

unread,
Oct 23, 2002, 2:04:55 PM10/23/02
to perl6-l...@perl.org

Where is the most definitive list of known Perl6 (not Parrot) builtin
types?

The following have been specified/implied by the A/Es:

scalar
bit (== bool? == boolean?)

num
int
str

bigint
bignum
bitarray (maybe)

ref
rx (or regex,rule?)
code
classname
Object
array
hash

But also stated is that perl6 will have enough type information to
easily interact with other languages, which implies to me that types
must exist which, at minimum, mirror the C types (maybe by the same
names, maybe not, maybe both)...

int (char, long, short, whatever)
int8
int16
int32
int64
uint
uint8
uint16
uint32
uint64
float
double (long double, etc?)
cstr (null-terminated, non-Unicode-aware?)

.... which wouldn't be used in typical programming, but would be needed

to define signatures for things pulled in from other libraries?

And perhaps

bin
oct
hex

should be builtin types subclassed from uint, but with overloaded
(de)serialization such that:

my int $i = 0x0a; print $i; # prints '10'
my int $i = '0x0a'; print $i; # prints '0'

my hex $i = 0x0a; print $i; # prints '0a'
my hex $i = '0x0a'; print $i; # prints '0a'
my hex $i = '0a'; print $i; # prints '0a'

.... for helping with the variety of shell tools that Perl is so good at
producing.

What's the closest to a definitive list, so far?

MikeL

Nicholas Clark

unread,
Oct 23, 2002, 3:49:34 PM10/23/02
to Larry Wall, Michael Lazzaro, perl6-l...@perl.org
On Wed, Oct 23, 2002 at 11:40:40AM -0700, Larry Wall wrote:
> "returns" is synonymous with "of", mostly so we can use "returns" on
> subroutines, because "of" sounds weird:
>
> my int sub foo () {...}
> my sub foo () of int { ... }
> my sub foo () returns int { ... }

I read this and I think

sub ... () of Borg { }

but I can't work out what ... should be for the best joke. Nevermind. I'll
just blatantly plug the spoofathon. (The Borg are better than perl
because...?)

Nicholas Clark
--
INTERCAL better than perl? http://www.perl.org/advocacy/spoofathon/

Brent Dax

unread,
Oct 23, 2002, 10:03:28 PM10/23/02
to Nicholas Clark, Larry Wall, Michael Lazzaro, perl6-l...@perl.org
Nicholas Clark:
# I read this and I think
#
# sub ... () of Borg { }

<joke type="lame">

sub ven () of Nine { ... }

</joke>

--Brent Dax <bren...@cpan.org>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
--Albert Einstein (explaining radio)

0 new messages