<br><br><div class="gmail_quote">On Sat, May 12, 2012 at 12:49 AM, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org" target="_blank">eli@barzilay.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">5 hours ago, Neil Toronto wrote:<br>
> On 05/09/2012 02:18 AM, Laurent wrote:<br>
> > From the guide: "Caveat 1: Until language specifications come with<br>
> > fixed indentation rules, we need to use the default settings of<br>
> > DrRacket’s indentation for this rule to make sense."<br>
> ><br>
> > Maybe a special submodule like drracket-indentation with<br>
> > declarations like:<br>
> > (module+ drracket-indentation<br>
> > (like-lambda my-lambda my-function ....)<br>
> > (like-begin my-begin ....)<br>
> > )<br>
> > could be useful for user-specific indentation.<br>
> ><br>
> > As a submodule, Racket can read&load it only at appropriate<br>
> > moments. When indenting the file, DrRacket could first load the<br>
> > drracket-indentation module of the file to know how to indent it.<br>
> ><br>
> > One could then create a whole language with its own indentation<br>
> > rules. It would also be easier to add good indentations for<br>
> > for/fold and others.<br>
><br>
> That would be awesome for Typed Racket macros in particular. Its<br>
> `for' macros are great examples of forms that should have fairly<br>
> complex indentation rules. Optional type declarations make it<br>
> difficult to classify them as "begin-like", "define-like" or<br>
> "lambda-like".<br>
<br>
</div></div>That kind of indentation specification is more fitting in the language<br>
info, together with coloring etc.<br></blockquote><div><br>Probably. But how can the user specify its own rules then? <br>(genuine question, I don't know where the language info lies, and how it can be extended)<br> <br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
For specific macros in some random file something that I suggested in<br>
the past could work better: have an ability to use "sub-namespaces"<br>
where an identifier can have a number of related bindings -- so you<br>
could define `foo' and some `foo@indent' (or whatever) which specifies<br>
indentation. The reason that this would work better is that any<br>
context that receives the `foo' binding would also get its<br>
indentation.</blockquote><div><br>Interesting idea.<br>
Could sub-namespaces be loaded independently from the main identifier, in case you don't need it?<br>
Anyway, submodules already exists, hence my suggestion.<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Eg, think about providing it as `bar' -- if the rules<br>
are in a sub-module, then it won't work unless you construct your own<br>
sub-module.<br></blockquote><div><br>Unless `bar' knows its real name is `foo'? (which it does, maybe?)<br>Currently, DrRacket does not seem to be able to do this anyway<br>(which may be why you proposed sub-namespaces?):<br>
<br><span style="font-family:courier new,monospace">#lang racket</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">(require (rename-in racket [define gabuzomeu]))</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">(gabuzomeu (foo bar)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> (list bar))</span><br>
<br><br>So probably sub-moduled indentation rules would be a less important change than adding sub-namespaces, <br>and thus requires less work which makes it more probable to appear in a near future?<br><br></div></div>Laurent<br>