Torsten Anders wrote:
> On 15.03.2006, at 12:16, Boriss Mejias wrote:
>
>> _Something looks more readable than _/*Something*/
>>
>> proc {Foo Id _/*Name*/ _/*Address*/} ... end
>>
>> is less nicer than
>>
>> proc {Foo Id _Name _Address} ... end
>
> I see what you mean, its convenient. I also realise that this construct
> is already an established device in other languages.
>
> Unfortunately, there is another thing: How likely is it that existing
> code does (perhaps accidentally) something like
>
> {P _X}
>
> instead of
>
> {P _ X}
>
> So far, the compiler treats both the same.
>
> declare
> X=1
> proc {P X Y} {Browse X#Y} end
>
> {P _X}
>
> Could introducing the notation _X as a single value break existing code?
Technically it could, but I think that a more important issue is what happens
when new code is compiled using an old compiler. If this change were a strict
extension, then what should happen is that the old compiler rejects the program.
In fact, it will silently treat it as having a different meaning. Regardless of
whether we consider this a bug, or a correct application of the longest-match
rule, it still argues against making this change.
The variant that uses trailing _'s, OTOH, has no such problem, and the only
compatibility issue is potentially spurious warnings for code that was using
a trailing _ to mean something else. To deal with that, I think it is sufficient
to have an option to turn the 'variable with trailing _ is used' warning off.
--
David Hopwood <[EMAIL PROTECTED]>
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users