-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
${myFunction}
idiom not supported by xs
#426
Comments
This is too ugly, as it mixes directly authored source text with generated text. This is too hard to keep in correspondence. To figure out how to deal with this, let's keep in mind
|
Currently, the bundle-source package is how we abstract the dynamic loading of modules. Perhaps |
Since I gave you that impression I have learned otherwise; there's an I haven't figured out how to use it yet, and I'm not sure we want to, but the facility does seem to be there. This point is tangential to this issue; I wonder if there's a better issue or if there should be. |
I could agree that the present incarnation is too ugly, but I got the idea of mixing directly authored source text with generated text from you; have you since changed your mind? Or did I misunderstand?
|
The current bundle-source API (a) uses rollup, which I doubt is feasible on xs, and (b) assumes ambient
|
I don't remember what I said, and my apologies if I'm contradicting myself. It would not be the first time that I suggested X, someone did X, and then I complained that X needed to become something else. Here's a form of source that would be better, and is probably the right short term fix: Instead of making them unreadable strings, make them template strings with newlines shown as new lines, so the whole thing is human readable. I don't understand why your discovery is tangential. It seems like it should enable the right long term fix, and could be abstracted by bundle-source as the next step (see #438 ). |
Yes, absolutely. We must stop using rollup or any translator we don't control. We should be able to use https://github.com/Agoric/make-importer to make our rollup replacement for environments (not XS) where we must transform into evaluable strings. Given your discovery, I'm hopeful we can load module more directly on XS. |
I also forgot that @jfparadis tested and found: The dynamic import expression works inside a statically loaded module, and dynamically loads new modules into the importing module's |
Correct. Look at this simple gist: The key file is
I have a more advanced example that I will load in another gist. |
This is the more advanced API: The key file is // This shim only support mapping for referrer "*". Although it works, it
// makes little sense to specify anything else but bare and absolute
// specifiers with referrer "*".
const cmp = new SESCompartment({}, { '*' : { './mod1': './mod1' } });
// Populate the global before any module is loaded.
cmp.global.g1 = g1Value;
// Load the module.
cmp.import('./mod1'); The key here is the mapping for modules: const modules = { '*' : { './mod1': './mod1' } } It goes from
|
new modules? I don't see that yet. I can see that |
@dckc Correct, AFAIK. |
I wonder if |
oops... but |
Hmm... perhaps we could tweak the xs platform module hooks |
Could these hooks be reflected back into JavaScript? Attn @phoddie |
I'm not entirely sure I understand the goal here and so hesitant to offer much guidance. The descriptions above are in the context of Agoric work that I don't understand. A statement of the problem from a JavaScript-only perspective might help. FWIW - you may be able to call back into JavaScript from the fxLoadScript host hook. But... assuming a script is allowed to execute at that time by the spec, doing so seems to have the potential to lead to the kind of engine bugs that Natalie Silvanovich warns about. |
I worked out some of the details... XS provides an https://gist.github.com/dckc/cbbd3e8469723b342cc90799ace7a287
I'm not sure what you have in mind, but that seems like a lot more trouble than it's worth. Calling JavaScript involves unknown amounts of heap allocation plus On the other hand, what I have in mind for setting a flag is a new host function. So in that sense, yes, this flag hook would be reflected back into JavaScript. |
So the latest discussion on these kinds of topics was that we will take baby steps that still have rollup bundling (for CommonJS support). Right now, this means using the But in all XS cases, we will want to move to bundling most code ahead of time, so there is no rollup at runtime, and then teach SwingSet how to interpret the bundles. |
${escrowExchange.checkUnits}
idiom not supported by xs${escrowExchange.checkUnits}
idiom not supported by xs
Removed mention of ERTP, since that part is stale |
${escrowExchange.checkUnits}
idiom not supported by xs${myFunction}
idiom not supported by xs
This limitation of XS is not blocking anything any more, AFAICT. |
I have the pixel demo nearly running on xs!
But when I try the
hostInvite = E(home.gallery).sellToGallery(units2);
step, I run intoSyntaxError: missing ,
. I traced it to an attempt to evaluatefunction checkUnits (){[native code]};
which is what xs produces from (a bundled version of) this code:agoric-sdk/packages/ERTP/core/escrow.js
Line 129 in f833610
As discussed back in Oct:
@erights suggested:
So I plan to try something of that sort.
for reference: spec for Function.prototype.toString()
The text was updated successfully, but these errors were encountered: