Thom wrote:
> Thanks for putting everything in "context" Herby ! :-) I might have > the nerve now to try to figure out how to get the Amber runtime working > within a running instance of a JavaScriptCore virtual machine + context. > It's likely only marginally more involved than getting Amber to run > using node.js or in a browser. BTW, amber cli has a repl, it's maybe good place to look at how is it implemented to learn how to compile and run ad-hoc code. > On Thursday, September 28, 2017 at 9:35:07 AM UTC-4, Thom wrote: > > JavaScriptCore is a framework that can be used natively within any > macOS, iOS, watchOS, or tvOS app (any of the four current platforms > for deploying Apple-native apps). > > It can creates any number of JS runtime contexts within any number > of JS virtual machines, each which can run any number of > simultaneous contexts. The simplest and most common case is when > the user of the framework creates one JS runtime context that > automatically runs within the default virtual machine. > > Here's a good JavaScriptCore overview with some helpful diagrams. > <https://www.raywenderlich.com/124075/javascriptcore-tutorial> > Here's some older info from when JavaScriptCore was first developed > as part of the Safari WebKit, which may help clarify the purpose for > which it was developed. <https://trac.webkit.org/wiki/JavaScriptCore> > > It's very helpful to know now that if a potential solution can be > developed, it's all about finding a way to run Amber within a JS > runtime virtual machine and context established via JavaScriptCore, > and not at all about just using basic string transformations. > > On Thursday, September 28, 2017 at 8:45:32 AM UTC-4, Herby wrote: > > Thom wrote: > > Greetings, > > > > My interest is using Amber to facilitate a Smalltalk-like > > live-coding/scripting interface to some lower-level audio and > MIDI > > functionality running within a macOS executable, established > with Swift. > > The live-coding/scripting interface is already working well > when using > > JavaScript as the live scripting language, and also > alternately using > > CoffeeScript <http://coffeescript.org> to achieve a cleaner, > more > > elegant syntax with less boilerplate than when using standard > JavaScript. > > > > When I first encountered CoffeeScript awhile back, I was > immediately > > drawn to its cleaner syntax and was interested in finding a > way to use > > it for live interaction with my Swift code via the > JavaScriptCore framework. > > Since I knew then that CoffeeScript compiles to JavaScript, I > thought it > > would be relatively straightforward for figuring out how to > make it work > > for my use case. > > > > It turned out that I wasn't able to make any progress in that > direction > > on my own. After a few months of occasional googling, I was > fortunate > > one day to find this CoffeeScript-to-JavaScript compiler > self-contained > > within this one page of JavaScript code > > > <https://gist.github.com/JamesKyburz/c840e047c278ebd356245739af605432 > <https://gist.github.com/JamesKyburz/c840e047c278ebd356245739af605432>>. > > > > > I was very pleased to find that it does exactly what one > would expect it > > to do. After adding this coffeescript.js file to my Xcode > project's > > Resources folder, I wrote a little routine in Swift that > locates any > > .coffee file in a designated directory, extracts its contents > as a > > String, then transforms it into JavaScript code by passing > the string > > into the top-level JS function contained within the > coffeescript.js file > > > <https://gist.github.com/JamesKyburz/c840e047c278ebd356245739af605432 > <https://gist.github.com/JamesKyburz/c840e047c278ebd356245739af605432>>. > > > > > Now I can use the JavaScriptCore framework as usual for > preparing my > > Swift code to both call into and be called from JavaScript, > and then use > > either <JavaScript code> or <CoffeeScript code automatically > transformed > > into JavaScript code> as the runtime scripting interface. > > > > Does anyone know offhand if something similar could be made > possible for > > using Amber Smalltalk code as an alternative to CoffeeScript? > Is it > > possible to transform any string containing Amber code > directly into its > > target JavaScript code, or would it require running Amber > using Node.js > > and so forth? > > Smalltalk is image-based in nature, so it can not be effectively > used > for small snippets - it sort-of takes for granted that it has its > libraries (objects, classes, numbers, collections, etc.) > present. So > Amber code cannot run without an Amber runtime (though, that > runtime can > be embedded with the code, of course - but the runtime is big). The > Amber's use case is applications. > > Amber compiles to JS, so needs JS environment to run. I don not > understand what environment do you use. Amber is primarily based at > browsers, can run in node.js as well. > > And of course, there is a way to compile a code, but again, that > code > needs to run in context of an Amber runtime. > > > I welcome any suggestions, advice, guidance, comments, etc. > > > > Thanks ! > > > > Best, > > > > Thom Jordan > > > > -- > > You received this message because you are subscribed to the > > Groups "amber-lang" group. > > To unsubscribe from this group and stop receiving emails from > it, send > > an email to [hidden email] > > <mailto:[hidden email]>. > > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > -- > You received this message because you are subscribed to the Google > Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [hidden email] > <mailto:[hidden email]>. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Thanks again Herby, this time for the detailed guidance ! This should save a lot of time and prevent a good deal of potential misunderstanding on my part, providing enough insight for me to make a serious attempt at getting this to work without having to give up from being stuck right away at the outset. I really hate when that happens.
-- I'll post back here with any relevant news of progress and/or success. Thanks again, Thom On Thursday, September 28, 2017 at 10:13:31 AM UTC-4, Herby wrote: Thom wrote: You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |