[stack] Notation for typed arrays in Cat
"Christopher Diggins" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
I am again playing with the idea of how to introduce typed arrays in to Cat.
The following is the notation that I prefer, but I am concerned about
the confusion of ['a] meaning a list of 'a in types, and [a] meaning a
quotation in the code:
uncons : (['a] -> ['a] 'a)
cons : (['a] 'a -> ['a])
empty : (['a] -> ['a] bool)
count : (['a] -> ['a] int)
Another syntax I am seriously considering is:
uncons : ('a* -> 'a* 'a)
cons : ('a* 'a -> 'a*)
empty : ('a* -> 'a* bool)
count : ('a* -> 'a* int)
And yet another contender is:
uncons : (list('a) -> list('a) 'a)
cons : (list('a) 'a -> list('a))
empty : (list('a) -> list('a) bool)
count : (list('a) -> list('a) int)
This last one is interesting because it opens the door to the
possibility of full-blown meta-programming at the type-level. There
are hints of how the type-system could be used as a programming
language. Of course if I could also keep it postfix:
uncons : ('a list -> 'a list 'a)
cons : ('a list 'a -> 'a list)
empty : ('a list -> 'a list bool)
count : ('a list -> 'a list int)
This might be more consistent, but for some reason I feel more
comfortable with the prefix notation. It delineates the world of types
from the world of values more clearly for me.
Any thoughts or opinions on the subject would be appreciated.
- Christopher