develooper Front page | perl.perl6.language.data | Postings from September 2000

Re: Notice of intent to freeze RFCs 204, 206, and revise 207

Thread Previous
From:
Jeremy Howard
Date:
September 20, 2000 14:29
Subject:
Re: Notice of intent to freeze RFCs 204, 206, and revise 207
Message ID:
004501c0234a$6eabaa70$c1252ccb@SAMANTHA
Buddha Buck wrote:
> On RFC 204 (LOL refs as indices), I have followed the discussion from
> Ilya that list references will have problems when objects that used
> blessed references to lists as their internal representation are used
> as indices.  This does indeed seem to be a problem, but I'm uncertain
> how big of a problem.
>
> Would it help if the RFC stated that the index had to be either a
> scalar integer or an ARRAY ref of integers?  Since objects would be
> blessed as something other than ARRAY, they would need to be converted
> first.  If it was an object, it would try to call standard methods to
> convert to a scalar integer, a list of integers, or an ARRAY ref of
> integers.  Just an idea.
>
There are two options to resolve any potential ambiguity:

 1. Require that LOLs as indexes be unblessed, or
 2. Define interface precedence to resolve ambiguity

(1) is obvious. (2) is simply a case of defining precedence such as:
----
"If a scalar used as an array index overloads operators such that it has
both a LOL interface, and a integer interface, it is treated as an LOL for
the purpose of array indexing"
----

I prefer (2), because an object with an LOL interface should act just like
an LOL, and work anywhere an LOL works.
> On RFC 207 (efficient array loops), based on discusion and additional
> thought on my part, I want to clarify and change the syntax used in the
> RFC.  I also want to go into more detail about how the scope of the
> efficient array loops is derived.
>
I agree with all of your proposed changes. Also, incorporate the rules that
define the width of the implied loop, that you included in an earlier email
to the list.



Thread Previous


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