Annotations
Edward A Kmett
ekmett at gmail.com
Wed Nov 6 12:48:01 UTC 2013
Currently, in all the cases I can think of if the splice generates something that uses an extension then the module must have that flag turned on.
Sent from my iPhone
> On Nov 6, 2013, at 6:57 AM, Gergely Risko <gergely at risko.hu> wrote:
>
> On Wed, 6 Nov 2013 10:55:09 +0000, Simon Peyton-Jones <simonpj at microsoft.com> writes:
>
>> I’m inclined to add a language extension “Annotations”.
>>
>> · Without it {-# ANN … #-} pragmas are ignored as comments
>>
>> · With it, they are treated as annotations
>>
>> Do you agree?
>
> I generally agree that this should be a language extension.
>
> My only worry is around the just implemented TH additions regarding
> annotations. I don't clearly see what would happen if:
> - a TH library exports a function that generates annotations when spliced.
> - and the user uses this function in a .hs file,
> - without specifying the language extension.
>
> I'd it to work even in that case.
>
> I guess the behavior in this corner case depends heavily on how this is
> actually implemented. If e.g. the reader is the only component that
> checks if the language extension is turned on, then I imagine that the
> TH way of putting in the annotation into the AST would just work.
>
> On the other hand if the reader recognizes the annotations either way
> and some component after TH splicing is checking for the language
> extension, then my use-case would blow up.
>
> TH currently is lenient in cases like this. E.g. if you know that a
> Name is exported from a module and you reference it directly, without
> importing it everything will just work. I'd like to have the same
> behavior for annotations.
>
> Thanks,
> Gergely
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
More information about the ghc-devs
mailing list