Changes between Version 2 and Version 3 of SQLLikeComprehensions


Ignore:
Timestamp:
Oct 28, 2007 8:14:47 PM (7 years ago)
Author:
guest
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SQLLikeComprehensions

    v2 v3  
    8383== Ordering Syntax == 
    8484 
    85 TODO 
     85The paper uses a syntax based around the new keywords "order" and "by". For example: 
     86 
     87{{{ 
     88[ (name, salary) 
     89| (name, dept, salary) <- employees 
     90, salary > 70 
     91, order by salary ] 
     92}}} 
     93 
     94It has been noted that introducing a new keyword may not be desirable, especially given the fact that you can use "order" to achieve things which aren't really ordering: 
     95 
     96{{{ 
     97[ (the dept, sum salary) 
     98| (name, dept, salary) <- employees 
     99, order by salary 
     100, order by salary < 50 using takeWhile 
     101, order using take 5 ] 
     102}}} 
     103 
     104For those reasons, Max's implementation is currently based around the syntax proposed in section 6.1 of the paper: 
     105 
     106{{{ 
     107[ (the dept, sum salary) 
     108| (name, dept, salary) <- employees 
     109, then sortWith by salary 
     110, then takeWhile by salary < 50 
     111, then take 5 ] 
     112}}} 
     113 
     114This reuses the "then" keyword and is probably less confusing. However, no final decision has been made on the optimal syntax: in particular it might be better to write: 
     115 
     116{{{ 
     117[ (the dept, sum salary) 
     118| (name, dept, salary) <- employees 
     119, then sortWith using salary 
     120, then takeWhile using salary < 50 
     121, then take 5 ] 
     122}}} 
     123 
     124Suggestions? 
     125 
     126== Grouping Syntax == 
     127 
     128Some of the same concerns about keyword introduction apply here, but ordering is being implemented first so not much thought has been given to syntax improvements. The main suggestion from the paper is: 
     129 
     130{{{ 
     131[ (the dept, sum salary) 
     132| (name, dept, salary) <- employees 
     133, group by dept ] 
     134}}} 
     135 
     136We could equally well substitute "using" for the "by" if desired: 
     137 
     138{{{ 
     139[ (the dept, sum salary) 
     140| (name, dept, salary) <- employees 
     141, group using dept ] 
     142}}} 
     143 
     144Or we could even do an implicit call to "the" on the grouped-by variables: 
     145 
     146{{{ 
     147[ (the_dept, namesalary) 
     148| (name, dept, salary) <- employees 
     149, the_dept <- group by dept 
     150    where (name,salary) -> namesalary 
     151] 
     152}}} 
     153 
     154We would be interested in hearing peoples thoughts on these issues. 
    86155 
    87156