You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Morel should use = rather than as for assigning column aliases. Morel already uses = in records but it currently uses as in group and compute clauses.
Using as is inconsistent with uses of = elsewhere, and will be confusing when we implement Standard ML layered patterns (e.g. val x as (fst,snd) = (2, true)).
Currently we would write
from e in emps,
d in depts
where e.deptno = d.deptno
group e.id + d.deptno as x, e.deptno
compute sum of e.id as sumId;
but this would become
from e in emps,
d in depts
where e.deptno = d.deptno
group x = e.id + d.deptno, e.deptno
compute sumId = sum of e.id;
If you want an expression with =, you should enclose in parentheses, e.g.
from e in emps
group parity = (e.id mod 2 = 1) compute c = count
This is no great hardship; there are only automatic aliases for variables and field references, and e.id mod 2 = 1 is an expression, so you would have had to provide an alias anyway.
The text was updated successfully, but these errors were encountered:
julianhyde
changed the title
Use '=' rather than 'as' for assigning column aliases
Use = rather than as for assigning column aliases
Mar 22, 2020
julianhyde
changed the title
Use = rather than as for assigning column aliases
Use = rather than as for assigning column aliases in group and computeMar 23, 2020
Morel should use
=
rather thanas
for assigning column aliases. Morel already uses=
in records but it currently usesas
ingroup
andcompute
clauses.Using
as
is inconsistent with uses of=
elsewhere, and will be confusing when we implement Standard ML layered patterns (e.g.val x as (fst,snd) = (2, true)
).Currently we would write
but this would become
If you want an expression with
=
, you should enclose in parentheses, e.g.This is no great hardship; there are only automatic aliases for variables and field references, and
e.id mod 2 = 1
is an expression, so you would have had to provide an alias anyway.The text was updated successfully, but these errors were encountered: