Re: [q-lang-users] H/M-based typing for Q
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-12-01 07:33:56
|
Andrew Berg wrote: > Speaking as a (only mostly) reformed ADA programmer, who cannot even send in a bug report without mangling the script; I would love something like perl's "use strict;" and "use warnings;" options. You can achieve that by putting a line like #! -w or #! -w2 at the beginning of your main script. You can find an explanation of these "shebang" lines in Section B.4 of the manual, http://q-lang.sourceforge.net/qdoc/qdoc_14.html#SEC154. (Well at least it's supposed to work that way, but actually it doesn't right now because of a bug in the compiler's option parsing code. That bug is already fixed in cvs, though. The relevant changes are in qc.y, see http://q-lang.cvs.sourceforge.net/q-lang/q/src/qc.y?view=log.) Another method, if you're using emacs, is to configure Q mode to add the -w or -w2 option to the interpreter command line; you can find that under "Q => Customize => Q Prog Opts". BTW, it would be nice if you could follow up to your bug report and resend the (corrected) version of the script, so I can try to reproduce the bug. > I spent a few years looking at Smalltalk or Self type languages, and thought that Self especially could benefit from having a bit more static type information, but that putting it everywhere, and in every script, was too much burden on the programmer. Just putting it where it is not machine discoverable, and only in the performance sensitive areas of the code seems like a better compromise. Well, the idea behind those H/M-based systems is that the type checker can figure out the static typing mostly by itself, and explicit annotations are only needed rarely, if at all. But I still have to see whether Nathan's type checker can actually do this even while supporting ad-hoc polymorphism. Whenever I tried to invent a type system that does this and offers full inference I ended up with a system that is 100% permissive (i.e., there are no typing errors at all). ;-) But it looks like Nathan might have found a way to handle that issue. > On a sort-of-but-not-quite-related theme, I've always wanted a compiler which would re-emit the source code (with all comments retained) in some normal form, with all the redundant parenthesis removed, and optionally reformatted into the canonical format for that language. Well, a complete grammar for Q can be found in the qyacclex tarball. It should be a piece of cake (a rather big one, though ;-) to add the necessary semantic processing and make the necessary changes so that comments are retained. Any volunteers? Cheers, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |