<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Henk Boom wrote:</div><blockquote type="cite"><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">I actually meant without the parentheses. I've never tried this, but</span></blockquote><blockquote type="cite">I'm under the impression that this can be done with<br>make-set!-transformer.</blockquote><div><br></div><div>That's what I'm using in this new code. It definitely sounds like we're thinking along the same lines.</div><br><div><blockquote type="cite">Dave Gurnell wrote::<br></blockquote><blockquote type="cite"><blockquote type="cite">[...]&nbsp;<span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">if you use person with parentheses, you get what is effectively an&nbsp;alias for use in queries:</span></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;</span></font><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; "><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;(person) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; ==> table-alias</span></font></span></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;(person name) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; ==> column-alias<br></span></font></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;(sql (select #:from (person)))</span></font></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">That could work, but why not allow the use of the accessors directly?&nbsp;<span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">[...]</span></blockquote><blockquote type="cite"><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">rather than using person-name as an&nbsp;accessor and (person name) as an alias, </span></blockquote><blockquote type="cite"><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">you allow the use of&nbsp;person-name as both a structure accessor and as an sql</span></blockquote><blockquote type="cite"><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">column alias. I&nbsp;think that would be much clearer to use.</span></blockquote></div></div><div><br></div>Ah yes... I get you. That's a neat way of doing it.&nbsp;There are a lot of factors in play here, though, and I can see arguments that run both ways.<div><br></div><div>One thing to consider is that there are two query languages in Snooze. There's the syntax query language, which is terse and neat:</div><div><br></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;(sql (select #:from (inner person employer (= person-employer-id employer-id))))</span></font></div><div><br></div><div>and there's a procedural version that's a little more flexible in that you can use things like "apply":</div><div><br></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;(sql:select #:from (sql:inner person employer (apply sql:= (list person-employer-id employer-id))))</span></font></div><div><br></div><div>(The latter is provided from snooze.ss but is pretty poorly covered in the docs.)<br><div><br></div><div>I find that the procedural language is an infrequent but definite necessity in Untyped applications: there are a few queries that just can't be constructed without it. Ideally we need a consistent way of referring to aliases that works in both situations.</div><div><br></div><div>The unparenthesised approach is fine in the syntax language because we can design the language to interpret identifiers in whatever way is appropriate. The procedural language is tricker, though, because it is just regular Scheme.</div><div><br></div><div>The identifier "person" is already used at expansion time (struct type identifier) and run time (entity metadata). We need a way of referring to the alias (instead of these other things) when we're in a query.</div><div><br></div><div>The parenthesised approach works for this because a parenthesised use of the identifier can always be resolved to an alias:</div><div><br></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;(sql:select #:what (list (person name)) #:from (sql:inner (person) ...))</span></font></div><div><br></div><div>However, the unparenthesised approach requires further thought. One approach would be to store a default alias in the entity metadata and lift entities and accessor procedures at run-time (neat but slower):</div><div><br></div><div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px; ">&nbsp;&nbsp;(sql:select&nbsp;#:what (list person-name)&nbsp;#:from (sql:inner person ...)))</span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div></div><div>Another approach would be to require the programmer to wrap the identifiers in (sql ...) blocks so the identifiers can be interpretted at expansion time (faster but much messier):</div><div><br></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;(sql:select #:what (list (sql person-name)) #:from (sql:inner (sql person) ...)))</span></font></div><div><br></div><div>And now it's after midnight. I'm probably not making much sense so I'll stop. This is definitely worth further discussion, though. I'll give it some solid thought, chat to the other Untypers, and post again when the ideas are more solidly formed in my head.</div><div><br></div><div>Thank you for the injection of fresh ideas!</div><div><br></div><div>Cheers,</div><div><br></div><div>-- Dave</div><div><br></div></div></body></html>