Re: 0-arity compound terms
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 11/27/2013 01:37 AM, Richard A. O'Keefe wrote: > I wouldn't be bothered in the least by allowing > foobar() > as syntactic saccharine for > foobar > > I also think that if you want "more conventional-looking" domain > specific languages, it is a mistake to try to force Prolog syntax > to accommodate them. Let's say I want to embed F# in Prolog. > (And why not? F# has a bad case of the uglies, but it's a very > _useful_ language.) It has perfectly conventional bracketed > comments using the perfectly conventional "(*" opener and "*)" > comment brackets and as is quite conventional, these things nest. > So should Prolog accept these things as well? We have been at this square. First of all, there are DSLs, which I assume are basically domain specific inventions and integrating concrete other languages. These are two issues. The latter is generally better solved using quasi quotations. If you can get `close enough' using Prolog syntax, this might be a better option. Nicos' R interface is an example where I think that using Prolog syntax (given some of the V7 extensions) is better than using quasi quotations. If you decide to define a DSL to accomodate a more concise and/or natural description of your domain you want building blocks that allows for creating an as natural as possible representation. That is an important reason why we have operators. It is also the reason why SWI supports A[42] as valid syntax (and YAP, ECLiPSe, B-Prolog, Ciao (not sure)). f() is just another example of a commonly found construct that is a useful building block for defining the syntax of such languages. I do not expect much use outside this limited application area. Of course, one never knows. It might be that someone finds another good use for f(). Cheers --- Jan > And while we're on the subject of strings, there is of course > the well known convention of using \ for character escapes, > except that (a) some languages use *, (b) some languages use %, > and (c) no two languages agree on what all the escapes are. > You'll find \010 meaning either BS or LF. > > Trying to make one language look like another, unless you can > do a nearly complete job of it, just puts up the error rate. > Frequent sharp reminders that you _aren't_ in Kansas any more > are actually a big help. > > I find that the Haskell community have got an amazing amount of > benefit out of making their embedded languages look like Haskell > rather than the other way around. > > _______________________________________________ > SWI-Prolog mailing list > [email protected] > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog >