hydromatic / morel

Standard ML interpreter, with relational extensions, implemented in Java
Apache License 2.0
291 stars 15 forks source link

Allow comma-separated scans in `join`, and `on` in the `from` clause #216

Closed julianhyde closed 5 months ago

julianhyde commented 5 months ago

Currently you can have comma-separated scans immediately following from, like this:

from e in emps, d in depts

but not following join. The following query is now legal:

from e in emps
  where e.job = 'CLERK'
join d in depts,
  l in locations

It's especially useful for declaring unbound variables:

from a, b
  where a < b
join c, d, e, f
  where a > 0
    andalso b > 0
    andalso c > 0
    andalso d > 0
    andalso e > 0
    andalso f > 0
    andalso a + b + c + d + e + f < 10

Also, you now can use on in from:

from e in emps, d in depts on e.deptno = d.deptno

Previously on was only allowed in join. on in the first scan after from was, and remains, illegal:

from e in emps on e.sal > 10,  (*) illegal 'on'
  d in depts