[plt-scheme] Student parsing problem
David (cc'ing other parcipants)-
On Jun 2, 2009, at 7:15 PM, David Van Horn wrote:
> Carl Eastlund wrote:
>> I have had students run into the same problem with #; comments,
>> that a
>> #; before whitespace or another comment could be forgotten. I think
>> all of the s-expression-eating reader forms should have the "no
>> whitespace/comment" restriction in the student languages.
>
> I frequently use the pattern
>
> #;
> (define (f x) ...)
>
> in student language programs. It preserves the indentation of the
> definition and this program should be acceptable, IMO.
I think a reasonable middle-ground that would catch the majority of
the cases would be that no *comments* should split a { ` ' #; } from
the s-exp it is acting on, but white space is allowed.
That is, when there is just a (potentially large) swath of whitespace
separating the two, then is usually not so hard to puzzle out the
problem.
The times that I have been flummoxed by this (as in when I have been
looking over students' shoulders and been mystified) is when the
students have written a huge block of comments before their function,
and then at the very top comment they have an accidentally typed:
`;; This is our great code.
;;; We spent twenty-six hour debugging
;;; and we do not know what is wrong and
;;; why we cannot run our function and
;;; we are very tired.
;;;
;;; ...
or
#;; This is our great code.
;;; ...
This kind of thing is much harder to spot. (The first case is the one
that I have actually run into in practice; I have not seen the second
in the wild.)
-Felix Klock