The full Racket language allows constructing an instance of a structure with the name of the structure by itself (e.g. posn) or prefixed with make (e.g. make-posn). The Intermediate Student language only allows the latter. But the error message for the former is confusing. Specifically, it mentions a supposed make-signature function which is not in the documentation anywhere.
(posn 0 1)
function call: expected a function after the open parenthesis, but received (make-signature ...)
In ISL, the structure name is re-assigned to a signature constructor so that you say things such as (posn Number Number) or (-> (posn Number Number) Number) to check properties of functions.
But make-signature is not defined in ISL so the error message doesn't make sense in ISL.
Dear Dr. Felleisen,
Reassigning the structure name to be a signature constructor [0] creates an incompatibility between Intermediate Student and the full Racket language. With respect, I don't know that this is justified. The _How to Design Programs_ textbook and our class use signatures in comments instead [1]. The full Racket language uses contracts [2], and Typed Racket has its own format [3]. Perhaps there is a middle ground between each of these four different syntaxes.
Besides posn, other structure names are not defined to be signature constructors. Consider the following interaction:
> (posn 0 1)
function call: expected a function after the open parenthesis, but received (make-signature ...)
> (define-struct book (title author))
> book
book: structure type; do you mean make-book
> (book "Harry Potter" "JK Rowling")
book: expected a function after the open parenthesis, but found a structure name
If you really want posn to work this way, then the issue is with the error message. If a teaching assistant or another programmer were to point out the error in the code, they would say, "You left off the make- from make-posn," or "posn is a structure, and make-posn is the constructor for the structure." For the book structure above, the error message was clear, "book: expected a function after the open parenthesis, but found a structure name."
If you really want to mention make-signature in the error message, then I should be able to use make-signature in the interactions pane, and it should yield search results in the documentation [4]:
> make-signature
make-signature: this variable is not defined
I respectfully request that you re-open this issue.
[0] https://docs.racket-lang.org/htdp-langs/intermediate.html#%28def._htdp-intermediate._%28%28lib._lang%2Fhtdp-intermediate..rkt%29._posn%29%29
[1] http://www.htdp.org/2018-01-06/Book/part_one.html#%28part._sec~3ainput-errors%29
[2] https://docs.racket-lang.org/reference/contracts.html
[3] https://docs.racket-lang.org/ts-reference/index.html
[4] https://docs.racket-lang.org/search/index.html?q=make-signature
Regards,
Brian Schack
Transferred to https://github.com/racket/htdp/issues/52
FWIW, compatibility of *SL with Racket is a subordinate issue. While it is nice that students can relatively easily transfer to Racket, it is impossible to reconcile (my) pedagogic goals with total compatibility.
I just pushed a patch to deinprogramm-signature that has a custom error message for this situation:
function call: expected a function after the parenthesis, but received a signature
I'm sure it's not optimal, so happy to hear suggestions for improvement.
Thank you for changing the error message!