97jaz / gregor

Date and time library for Racket
45 stars 10 forks source link

Period function breaks strangely with fancy-app #23

Closed jackfirth closed 5 years ago

jackfirth commented 7 years ago

The fancy-app package provides an #%app macro that uses underscores as a shorthand for anonymous functions, e.g. (+ _ 10) => (lambda (x) (+ x 10)). The following program breaks:

#lang racket/base

(require fancy-app
         gregor/period)

(period _)

The syntax error ": wildcard not allowed as an expression in: " is raised. Other procedures from the gregor/period library work just fine, e.g. (months _) becomes an anonymous wrapper lambda around months.

97jaz commented 7 years ago

I'm not sure what's going on here. I can reproduce the problem, but I don't know the cause. I've had no end of trouble with custom struct constructors (specifically trying to get them to work with custom match expanders and contracts and Racket's provide machinery). I imagine that this is somehow a part of that, although I wasn't just now able to put together a fresh example that has the same problem.

I should see if this happens with the in-prgress datetime lib. It doesn't. Er... (On the other hand, it does have the problem mentioned in #18.) Well, the implementation in the new lib is nicer. Maybe I can just make the existing one more like that.

97jaz commented 5 years ago

This was fixed by #28