Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Variable/value type syntax

Newsgroups: perl.perl6.language
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <m...@self-reference.com>
Mailing-List: contact perl6-language-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-langu...@perl.org
Delivered-To: perl6-langu...@perl.org
Message-ID: <002301c302bf$26a40b80$6501a8c0@ralph>
To: <Austin_Hasti...@yahoo.com>,	"Luke Palmer" <fibon...@babylonia.flatirons.org>
Cc: <perl6-langu...@perl.org>
References: <20030413151104.60546.qmail@web12303.mail.yahoo.com>
Subject: Re: Variable/value type syntax
Date: Mon, 14 Apr 2003 14:50:43 -0500
MIME-Version: 1.0
Content-Type: text/plain;	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-SMTPD: qpsmtpd/0.25, http://develooper.com/code/qpsmtpd/
X-Spam-Check-By: one.develooper.com
X-Spam-Status: No, hits=0.8 required=7.0 tests=CARRIAGE_RETURNS,REFERENCES,SPAM_PHRASE_02_03,USER_AGENT_OE version=2.44
X-SMTPD: qpsmtpd/0.25, http://develooper.com/code/qpsmtpd/
Approved: n...@nntp.perl.org
From: m...@self-reference.com (Me)
Lines: 54

Piers, a thread summary for you. Of course it's long enough that
you'll have to summarize further:


1. Ralph argued that the current variable and sub declaration
   syntax:

    <var declarator> <val type> <var> <var type> <traits> = <val>;

   contains an aspect that is counter intuitive and illogical,
   namely the placement of the value type. Luke responded:

     "I agree with the idea of putting the variable type
      near the variable and the value type near the value."


2. Ralph suggested a syntax along the lines of:

    <var declarator> <var type> <var> <traits> <val type> = <val>;

   Leading to examples such as:

    my FastArray @array is Blah;    # FastArray is a variable type
    my @array is FastArray is Blah; # Same thing said differently
                                    # (nb: a vartype is a trait)

    my FastArray @array int;        # int is a value type
    my @array is FastArray of int;  # Same thing said differently

    my @array int = (3);            # int appears next to value
    my @array of int = (3);         # Same thing said differently
  

3. Luke raised some arguments in support of the current syntax:

   First, variable types must be specified in the form of C<is Foo>.
   This is consistent with traits in general which is a good thing.
   Ralph agreed, but noted that the changed syntax he had proposed
   retained the C<is Foo> syntax, rendering this argument largely
   moot.

   Second, Huffman argues for the most common sort of type (value
   or variable) to be specifiable without use of an extra keyword.
   Again, Ralph agreed, but noted that the changed syntax he had
   proposed achieved this.

   Third, C convention has the type appear before the identifier.
   Ralph noted that, in his proposed syntax, type info still
   appeared in the same syntax slot; the only difference being
   that it was now variable type info rather than a value type.


-- 
ralph