Konrad, 

Matthew’s response is probably all you want in principle, 
but I think that your ‘unit test’ looks like another person’s
‘integration tests’. Both are useful. 

Wouldn’t you want to use unit tests to validate the parser 
independently of the macros that expand the S-expression 
syntax you create with the parser? If you then discover a
failure, it becomes much easier to search for the bug in 
either of the two pieces. (I understand that there are many
more pieces but let’s say ‘two’ for now.) 

— Matthias






> On Aug 25, 2017, at 9:17 AM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
> 
> I forgot to explain why this fails:
> 
> At Fri, 25 Aug 2017 14:59:14 +0200, Konrad Hinsen wrote:
>> (eval-syntax
>>  (parameterize ([read-accept-lang #t]
>>                 [read-accept-reader #t])
>>    (read-syntax "test-module"
>>                 (open-input-string "#lang 
>> scribble/base\n@section[Introduction]")))
>>  (module->namespace 'racket/base))
>> 
>> only says
>> 
>> ; test-module::1: module: unbound identifier;
>> ;  also, no #%app syntax transformer is bound
>> ;   at: module
>> 
>> although both module and %app are defined in racket/base.
> 
> The `eval-syntax` function refrains from adding any scopes to the given
> syntax object before trying to expand it. So, it doesn't add the scope
> for the namespace's top-level bindings (unlike `eval`, which does add
> that scope before trying to expand). That's why `#%app` and `module`
> are not bound when trying to expand the syntax object in the above
> example; the syntax object has no scopes and therefore no bindings.
> 
> The `check-module-form` function adds a suitable scope to the `module`
> binding in the given syntax object. It would work just as well to not
> use `check-module-form` and to use `eval` so that the `module` binding
> is taken from the namespace.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to