User loginNavigation |
What's the type of an optional parameter?Functions in the language I'm building may have optional parameters, i.e. parameters that may or may not be supplied by the caller. In Common Lisp, unsupplied optional parameters receive NIL as their value. I want to avoid NIL, because I'd like to add an optional type system to the language later, and I don't want to have NIL as a value that's "in every type". So I've thought of making the type of optional parameters be like Haskell's Maybe: when the parameter is supplied with a value X, the function body receives it as Just X, and when the parameter is not supplied, it's Nothing (this means that for optional parameters, matching against Just or Nothing is always required in the function body). Thoughts? By Manuel J. Simoni at 2010-07-04 06:13 | LtU Forum | previous forum topic | next forum topic | other blogs | 5715 reads
|
Browse archives
Active forum topics |
Recent comments
27 weeks 2 days ago
27 weeks 2 days ago
27 weeks 2 days ago
49 weeks 3 days ago
1 year 1 week ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 5 weeks ago
1 year 10 weeks ago
1 year 10 weeks ago