You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if it would be reasonable to include a feature (exposed as part of the js package I imagine) to include raw JavaScript. I can see why this would be considered evil and ugly and all sorts of bad juju, as it would make syntax and type checking impossible in that code--but that's already true in JavaScript included in the *.inc.js fashion, so I wonder if it's really any worse. It's also evil in that it does magical things with a function with an otherwise normal appearance.
What I am imagining is a new js package method that looks something like the existing MakeFunc, and works something like JS's new Function() constructor. By requiring that any raw JS is encapsulated in a function, at least we maintain a clear barrier between JS and Go, and we don't start to look like PHP.
As a contrived example, we can presently use new Function() like so:
For me, this feels like too much magic. If we fix #306, then JS code can be put into a proper separate file and can be included similar to .s assembly files. Would that be okay for you?
I'm still thinking about #306 and #274.
I wonder if it would be reasonable to include a feature (exposed as part of the js package I imagine) to include raw JavaScript. I can see why this would be considered evil and ugly and all sorts of bad juju, as it would make syntax and type checking impossible in that code--but that's already true in JavaScript included in the
*.inc.js
fashion, so I wonder if it's really any worse. It's also evil in that it does magical things with a function with an otherwise normal appearance.What I am imagining is a new
js
package method that looks something like the existingMakeFunc
, and works something like JS'snew Function()
constructor. By requiring that any raw JS is encapsulated in a function, at least we maintain a clear barrier between JS and Go, and we don't start to look like PHP.As a contrived example, we can presently use
new Function()
like so:And it produces the following JS:
What I would like, is something that instead produces:
or a functional equivalent using an IIFE or somesuch.
I have a hacked up proof of concept (flimzy@f048c21) which takes the following input:
and produces:
Am I smoking crack to go down this road?
The text was updated successfully, but these errors were encountered: