On Mon, Feb 9, 2015 at 3:01 PM, Jonathan S. Shapiro <[email protected]>
wrote:

> I see two possible ways to look at this. The first is that we have a
> productions that looks like:
>
> expr := expr '|' generator
> expr := '[' expr ']'
>
>
> The other option is that we have a production somewhere that looks like:
>
> expr := '[' expr '|' generator ']'
>
>
> But that would appear to lead to the conclusion that we are only able to
> use comprehensions to produce a limited number of types that are
> syntactically known to the parser.
>

Full disclosure: I can see a third way that accounts entirely for how we
get the behavior we want out of [ expr ], but it seems unspeakably ugly to
me and I think there must surely be a cleaner way.

The third way is to define [ expr ] to buildAList(expr), and then use
overlapping instance resolution on buildAList(expr) to alter the behavior
in the event that the input expression satisfies Iterable 'a 'elemType

But that seems like a pretty damned dirty abuse of ad hoc overloading.
There has to be a way that doesn't require us to build support into the
grammar!


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to