Re: [racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread Yucheng Zhang
On 11 April 2018 at 06:48:49, Matthias Felleisen (matth...@felleisen.org) wrote: > Perhaps the real problem is one of the contract/type system. We have seen > effect systems > over and over again, though usually they try to express complicated > invariants and have > them checked at compile

Re: [racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread Matthias Felleisen
Alexis says that (-> vector? exact-integer? any/c void?) is better than (-> vector? exact-integer? any/c vector?) because the former clearly signals the imperative nature of the function inside of the spec while the latter could be either a read-only or a RW function. Perhaps the

Re: [racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread Neil Van Dyke
Alexis King wrote on 04/10/2018 03:32 PM: There is definitely a school of thought that buys into the idea of returning “the thing being operated on” rather than returning nothing for side-effectful functions. I think this is most characterized by so-called “fluent interfaces”[1], a way of

Re: [racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread Alexis King
> On Apr 10, 2018, at 14:00, David Storrs > wrote: > > Aside from I/O, I can't think of too many cases where (void) is the > intuitively correct or most useful return value, but it is extremely > common throughout the built-in Racket functions. I'm not sure where >

Re: [racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread David Storrs
On Tue, Apr 10, 2018 at 1:18 PM, Neil Van Dyke wrote: > Good catch; I agree that it would be better if `gzip` returned the target > path, in all cases. > > There is another change I'd make to that signature: currently, arg > `out-file` is optional, of type `path-string?`,

Re: [racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread Neil Van Dyke
Good catch; I agree that it would be better if `gzip` returned the target path, in all cases. There is another change I'd make to that signature: currently, arg `out-file` is optional, of type `path-string?`, defaulting to `(path-add-extensionin-file".gz"#".")`.  In a backward-compatible way,

[racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread David Storrs
A lot of functions in Racket return (void) instead of a useful value. One example is the gzip function from file/gzip; it would be useful if this returned the filepath to which the file was compressed, but instead it simply returns (void). I have a lot of respect for Racket and its designers, so