Hi,

Just playing with Oz, discovering features.

I find it desirable for the case statement to capture not only the values of fields, but also features and labels as well. As of now, case declares only identifiers that stand in the field-value position. Thus the following

declare
X = l(f:1)
case X of l(f:V) then {Browse V} end

displays 1, but the following

declare
X = l(f:1)
case X of l(F:V) then {Browse F#V} end

complains about unintroduced variable F.
I'd prefer the pattern to match a record with one field, any feature. But ok. Now, the scary thing is when the following is fed:

declare
X = l(f:1)
local F in
  case X of l(F:V) then {Browse F#V} end
end

where F is clearly introduced, but unbound, and the interpreter crashes with lots of curses (Mozart 1.3.2, Fedora).


In general, it would be fine if case could match patterns like

L(...) --- a record with any label and any number of fields

l(F:V ...) --- a record with a specific label, at least one field, the first field (where fields are sorted according tot he lexicographical order of the features, as in the arity of a record) having any feature and any value

l(F:v) --- a record with a specific label, and one field with a specific value

etc.

Otherwise, one has to use, e.g., Record.label and Record.arity to get at the label and features of a record one does not know.

vQ


_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to