pigeon
pigeon copied to clipboard
Add type safety
Dealing with interfaces can be quite burdensome. Why not add type safety to the project?
The data matched by a single character matcher type byte
, and if you are matching multiple items it's always an []
of whatever type underlies it. And instead of using simple { }
go blocks, have it with a bit more detail, but details that define types. Something like this: [int, error] { }
that defines we'll be returning an int
, and an error
@felipellrocha we are aware of the fact, that dealing with the interface{}
everywhere is not funny and therefore, having static typing is on the wishlist. Feel free to move forward with this and write an initial PR.
That being said, I am not yet sure, what the best way to implement this would be.
Does the generics now in 1.18beta1 help makes this more tractable?
Hi @delaneyj Interesting question. I doubt, that generics alone do improve the situation. I assume, that an extension of the PEG grammar would be needed as well. But I have to admit, that I did not think about this at length.