Jonathan Hall
Jonathan Hall
I have been thinking about something along these lines for a few weeks, but haven't said anything as the actual need hasn't arisen in my coding, so I haven't spent...
> > A common package could be referenced for all of the common code that ends up at the beginning of the output file right now. > > Right now...
It seems the new code fails when using a JS function as a map key. This minimal test case fails: ``` package main import ( "fmt" "github.com/gopherjs/gopherjs/js" ) func main()...
This seems to be the breaking change in `compiler/prelude/types.go`. Re-adding that line allows the test case to succeed again. ``` typ.methodSetCache = null; typ.comparable = true; - typ.keyFor = typ.keyFor...
This also solves this specific case: ``` --- a/compiler/prelude/types.go +++ b/compiler/prelude/types.go @@ -177,6 +177,7 @@ var $newType = function(size, kind, string, name, pkg, constructor) { typ.variadic = variadic; typ.comparable =...
Perhaps it comes as no surprise, but JS functions aren't unique. Using any function as a key map has the same problem. This code also fails: ``` package main import...
A quick audit of compiler/prelude/types.go, and a few more subsequent tests, suggests that the change also breaks Arrays, Maps and Slices as map keys. So I'm guessing that removal of...
That's good to know. I will refactor the test to not depend on that functionality.
> This solution doesn't seem to work in a library with multiple directories that refer to each other. If you run `go mod vendor`, then compile with GopherJS does it...
I'm not sure how directly this relates, but as it's related, I thought I'd bring it up to consider including in the discussion. I think the problem extends beyond just...