Re: [stack] Re: Notation for typed arrays in Cat

John Nowak <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Apr 4, 2008, at 6:48 PM, Daniel Ehrenberg wrote:

> A quick question: what's the rationale for using {a} as the type for a
> list instead of (List a)? There's no reason for lists to be built-in,
> right? Overall, though, that syntax is pretty clean-looking, I think.

Curly braces are used for list literals so the type syntax simply  
matches the expression syntax. This is the same reason that square  
brackets are used for the types of quotations. Using {a} instead of  
(List a) also helps keep type sizes a bit more manageable.

None of this is set in stone of course. In particular, I still have no  
good way for notating everything the effect system tracks. For  
example, if you pass a function two arrays and it mutates one of them,  
the effect system can tell you which of the two arrays is the one that  
gets changed. Unfortunately, I've not come up with a nice way to  
notate this yet.

I should also note that types are just normal s-expressions; {a}  
parses to (:list a) and [a b c] parses to (:quote a b c). As such,  
normal macros can give you parameterized type synonyms and possibly  
other useful things.

- John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.