log: text
| log line | log := content. line := prefix,text,'<br />'. <log.innerHTML = log.innerHTML + line > ! Well, IIRC you said you don't have inline JS in your Smalltalk code any more... kind of bugs me that you could not do the same thing as me: open the file, search for '<' and go one after another. Took me a minute. You should not outsource this to the list, if it's this obvious. (Yes, it would be nice if parse errors would also say which method they are parsing... fill an issue for that) Herby Dave Mason wrote: > I sent this to Nico a few days ago, but I'm getting kind of desperate, > so I am hoping somebody else can see something I'm doing wrong. I'd > happily debug myself, but all I get from amberc (with trace turned on) > is (after much trace info): > > Parse error on line 5 column 5 : Unexpected character < > > but this can't be referring to the 5th line of the file, which starts: > ----- > Smalltalk current createPackage: 'Kit'! > Object subc > instanceVariableNames: 'node id' > package: 'Kit'! > > !Kit methodsFor: 'not yet classified'! > ----- > > (I gave more context in an email to the list on Sept 25.) > > Any help much appreciated. > > ../Dave > > On Thu, Sep 26, 2013 at 1:07 PM, Dave Mason <[hidden email] > <mailto:[hidden email]>> wrote: > > Hi Nico, > > I'm just sending this to you at this point. This is all > open-source at some point, but not public in its current state. > This *shouldn't* need any external libraries, outside of the amber > kernel. > > Thanks for looking at it!. > > > > -- > 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/groups/opt_out. -- 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/groups/opt_out. |
Herby Vojčík wrote: > log: text > | log line | > log := content. > line := prefix,text,'<br />'. > <log.innerHTML = log.innerHTML + line > BTW, why not something more elegant, like line appendToJQuery: log asJQuery or something like that? innerHTML is considered evil ;-) > ! Herby -- 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/groups/opt_out. |
Thanks, Herby!
-- I did go through it searching for <.... several times.... thank you for catching what I repeatedly missed. On Tue, Oct 1, 2013 at 7:03 AM, Herby Vojčík <[hidden email]> wrote:
Because I have a goal of not using jQuery, or Canvas, or any other external libraries. (We could debate whether that is a reasonable goal, but right now I'm aiming for a small footprint.)
Thanks again! ../Dave 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/groups/opt_out. |
In reply to this post by Herby Vojčík
Dave Mason wrote: Parse error on line 5 column 5 : Unexpected character < log: text OK, will do. At least I now know that the line 5 is relative to the method definition line.
../Dave 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/groups/opt_out. |
Dave Mason wrote: > On Tue, Oct 1, 2013 at 7:00 AM, Herby Vojčík <[hidden email] > <mailto:[hidden email]>> wrote: > (Yes, it would be nice if parse errors would also say which method > they are parsing... fill an issue for that) > > > OK, will do. At least I now know that the line 5 is relative to the > method definition line. Each part (!-delimited) of Smalltalk fileout format is processed in isolation, reading the format is very straightforward, see Importer class if you want to see more. It basically runs some portions verbatim, setting up reader, and this reader is then fed subsequent portions until empty one appears. > ../Dave Herby -- 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/groups/opt_out. |
In reply to this post by Herby Vojčík
On Tue, Sep 24, 2013 at 5:28 PM, Herby Vojčík <[hidden email]> wrote:
-- As for this one, I don't know. The only things I see is that yuo do not lost any libraries using -l in amberc,, they may be missing. Tests definitely need SUnit, if you do any web page work, you'll probably need Canvas, etc. Thanks to Herby, I now can compile the older amber code in the new environment. I really like the way amber is going... the requirejs stuff is great! But.... I've spent a dozen hours over the last several days trying to get it to load properly, assuming I was being stupid or missing something important, only to eventually recognize that the code in the git trunk is essentially identical to what you get with npm install amber, and that they don't run out of the box! In particular, the developers must have some magic CodeMirror and requirejs and jQuery files installed, because if you do:
: ~/Downloads ; git clone https://github.com/amber-smalltalk/amber.git Cloning into amber... remote: Counting objects: 19076, done.
remote: Compressing objects: 100% (5651/5651), done. remote: Total 19076 (delta 14603), reused 17571 (delta 13247) Receiving objects: 100% (19076/19076), 13.79 MiB | 54 KiB/s, done. Resolving deltas: 100% (14603/14603), done.
: ~/Downloads ; amber/bin/amber serve Warning: project directory does not contain index.html Warning: project directory is missing an "st" directory Warning: project directory is missing a "js" directory
Starting file server on http://127.0.0.1:4000 and go to http://127.0.0.1:4000/amber/ in the browser, you get:
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:4000/amber/bower_components/jquery/jquery.min.js
Uncaught Error: Script error for: jquery
http://requirejs.org/docs/errors.html#scripterror require.min.js:8
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:4000/amber/bower_components/codemirror/lib/codemirror.js
Uncaught Error: Script error for: amber_lib/codemirror/lib/codemirror
http://requirejs.org/docs/errors.html#scripterror require.min.js:8
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:4000/amber/bower_components/require-css/css.js
Uncaught Error: Script error for: amber_lib/require-css/css
http://requirejs.org/docs/errors.html#scripterror require.min.js:8
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:4000/amber/bower_components/es5-shim/es5-shim.min.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:4000/amber/bower_components/es5-shim/es5-sham.min.js
Uncaught Error: Script error for: amber_lib/es5-shim/es5-shim.min
http://requirejs.org/docs/errors.html#scripterror require.min.js:8
Uncaught Error: Script error for: amber_lib/es5-shim/es5-sham.min
http://requirejs.org/docs/errors.html#scripterror require.min.js:8
Uncaught Error: Load timeout for modules: jquery-ui,amber_lib/jquery-tabby/jquery.textarea,amber_inc/CodeMirror/smalltalk,amber_lib/codemirror/addon/hint/show-hint,amber_lib/require-css/css!amber_lib/codemirror/theme/ambiance_unnormalized2,amber_lib/require-css/css!amber_lib/codemirror/lib/codemirror_unnormalized3,amber_lib/require-css/css!amber_lib/codemirror/addon/hint/show-hint_unnormalized4,amber_lib/require-css/css!amber_inc/CodeMirror/amber_unnormalized5,amber_lib/require-css/css!amber_css/amber_unnormalized6
http://requirejs.org/docs/errors.html#timeout
in the browser console. The bower version mostly runs (not quite), but it's for the pre-requestjs version of amber. I tried pointing amber.js at the bower_components version, but couldn't get it to work.
Sigh. I really love Amber, but you can't imagine how frustrated I am at this point. Could somebody either make the git head work, or provide instructions on how to set up the environment properly so this can all run. I found CodeMirror, but it doesn't seem to work with requestjs.
I also don't know what 'map' is for in amber.js, because it references a css.js which I can't find anywhere, Thanks in advance for any help you can provide.
../Dave 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/groups/opt_out. |
Dave Mason wrote: > On Tue, Sep 24, 2013 at 5:28 PM, Herby Vojčík <[hidden email] > <mailto:[hidden email]>> wrote: > > As for this one, I don't know. The only things I see is that yuo > do not lost any libraries using -l in amberc,, they may be > missing. Tests definitely need SUnit, if you do any web page work, > you'll probably need Canvas, etc. > > > Thanks to Herby, I now can compile the older amber code in the new > environment. > > I really like the way amber is going... the requirejs stuff is great! > > But.... I've spent a dozen hours over the last several days trying to > get it to load properly, assuming I was being stupid or missing > something important, only to eventually recognize that the code in the > git trunk is essentially identical to what you get with npm install > amber, and that they don't run out of the box! In particular, the > developers must have some magic CodeMirror and requirejs and jQuery > files installed, beca > > : ~/Downloads ; git clone https://github.com/amber-smalltalk/amber.git > Cloning into amber... > remote: Counting objects: 19076, done. > remote: Compressing objects: 100% (5651/5651), done. > remote: Total 19076 (delta 14603), reused 17571 (delta 13247) > Receiving objects: 100% (19076/19076), 13.79 MiB | 54 KiB/s, done. > Resolving deltas: 100% (14603/14603), done. > : ~/Downloads ; amber/bin/amber serve > Warning: project directory does not contain index.html > Warning: project directory is missing an "st" directory > Warning: project directory is missing a "js" directory > Starting file server on http://127.0.0.1:4000 And where's npm install (you need that for developer tools to work)? And where's bower install (you need that for browser dependencies to be present)? Don't tell it does not work out of the box, when you call git the box. But git is not the box. The box is 'whatever to get it _plus_ npm and bower to get the dev/lib dependencies'. > and go to http://127.0.0.1:4000/amber/ in the browser, you get: > > Failed to load resource: the server responded with a status of 404 ... > <http://127.0.0.1:4000/amber/support/requirejs/require.min.js> > in the browser console. The bower version mostly runs (not quite), but > it's for the pre-requestjs version of amber. I tried pointing > amber.js at the bower_components version, but couldn't get it to work. ??? > Sigh. I really love Amber, but you can't imagine how frustrated I am > at this point. Well, get the dependencies. Git just gets you amber, it's not it's job to configure it. The blame goes to amber not being properly released. If you would get it from npm it would get its npm dependencies with itself, the same goes for bower. And maybe there is even way to make load both when got from npm, I don't know. But if you get something from git, it never works out of the box. There is still some setup, since in git the projects are bare. > Could somebody either ma ke the git head work, or provide instructions It works. The fact is there probably aren't clear instructions to run 'npm install' to have dev tools working, and (only since last few commits) to run 'bower install' to have dependent web libraries present. Not to mention if you get them from these packaging repos not from git you don't need to call any install since all deps are installed automatically. > on how to set up the environment properly so this can all run. I > found CodeMirror, but it doesn't seem to work with requestjs. Delete it and let bower install get all web dependencies. > I also don't know what 'map' is for in amber.js, because it references > a css.js which I can't find anywhere, bower install > Thanks in advance for any help you can provide. > > ../Dave Herby -- 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/groups/opt_out. |
In reply to this post by Dave Mason-3
Dave Mason wrote:
> Could somebody either make the git head work, or provide instructions on > how to set up the environment properly so this can all run. I found I wrote something to README.md and to Getting started wiki page. Herby -- 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/groups/opt_out. |
On Fri, Oct 11, 2013 at 5:36 AM, Herby Vojčík <[hidden email]> wrote:
--
Bingo! Thanks. It was obvious that bower was involved somehow, but figuring out bower worked and integrated with amber was much less clear. But you've fixed that now. Much appreciated.
Now I can get back the the "real" problem. :-) (I have attached a very short standalone program that exhibits the problem.) This used to work, but doesn't now. (Note I don't want to use jQuery for what seem like good reasons.) I have code that does:
(document getElementsByClassName: 'program') do: [ : program | ...
]. getElementsByClassName returns a NodeList, which used to complain do: needed first and size methods, so I created a NativeCollection in which I defined those, and did a wrapClassName on NodeList to make it a subclass of NativeCollection. I used to do this in a helper js file:
------ Kit-helper.js: smalltalk.wrapClassName("NodeList", "Kit-Native", NodeList, smalltalk.NativeCollection); smalltalk.wrapClassName("HTMLCollection", "Kit-Native", HTMLCollection, smalltalk.NativeCollection);
------ but it was a bit tricky to get the loading right for that and I wanted to put as much as possible in Smalltalk, so I put the wrapClassName in a class method (see below) for NativeCollection. At one level it works fine. The classes/methods look fine, but I get '[object NodeList] does not understand #do:' when the code above runs. I looked at the console log and the first one is undefined (as expected), the second one is a proper NodeList smalltalk class, with wrapped set to true, and the third one is a proper NativeCollection with 2 subclasses. I also tried NativeCollection subclass: #NodeList instanceVariableNames: '' package: 'Kit-Native' at the end of the file (which was the way it used to be) but then the resulting class didn't have the wrapped attribute.
So I'm stumped. Any ideas greatly appreciated. Thanks ../Dave ------ Kit-Native.st: Smalltalk current createPackage: 'Kit-Native' !
SequenceableCollection subclass: #NativeCollection instanceVariableNames: '' package: 'Kit-Native'!
!NativeCollection class methodsFor: 'not yet classified'! wrap < require(['amber_vm/smalltalk'],function(smalltalk) { smalltalk.wrapClassName('HTMLCollection','Kit-Native',window.HTMLCollection,smalltalk.NativeCollection);
console.log(smalltalk.NodeList); smalltalk.wrapClassName('NodeList','Kit-Native',window.NodeList,smalltalk.NativeCollection,true);
console.log(smalltalk.NodeList); console.log(smalltalk.NativeCollection); }); >
! ! !NativeCollection methodsFor: 'not yet classified'! first <return self[0]> ! size <return self.length> ! ! ------ 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/groups/opt_out. NativeCollection.tgz (1K) Download Attachment |
One of the new commits just a few days ago made wrapping foreign JS classes available to Smalltalk runtime, so no helper files with wrapClassName should be needed any more. Just browse through last ones in github.
Dave Mason wrote: > On Fri, Oct 11, 2013 at 5:36 AM, Herby Vojčík <[hidden email] > <mailto:[hidden email]>> wrote: > > Dave Mason wrote: > > Could somebody either make the git head work, or provide > instructions on > how to set up the environment properly so this can all run. I > found > > > I wrote something to README.md and to Getting started wiki page. > > > Bingo! Thanks. It was obvious that bower was involved somehow, but > figuring out bower worked and integrated with amber was much less > clear. But you've fixed that now. Much appreciated. > > Now I can get back the the "real" problem. :-) (I have attached a very > short standalone program that exhibits the problem.) > > This used to work, but doesn't > for what seem like good reasons.) I have code that does: > (document getElementsByClassName: 'program') do: [ > : program | > ... > ]. > getElementsByClassName returns a NodeList, which used to complain do: > needed first and size methods, so I created a NativeCollection in > which I defined those, and did a wrapClassName on NodeList to make it > a subclass of NativeCollection. I used to do this in a helper js file: > ------ Kit-helper.js: > smalltalk.wrapClassName("NodeList", "Kit-Native", NodeList, > smalltalk.NativeCollection); > smalltalk.wrapClassName("HTMLCollection", "Kit-Native", > HTMLCollection, smalltalk.NativeCollection); > ------ > but it was a bit tricky to get the loading right for that and I wanted > to put as much as possible in Smalltalk, so I put the wrapClassName in > a class method (see below) for NativeCollection. At one level it > works fine. The classes/methods look fine, but I get '[obje > NodeList] does not understand #do:' when the code above runs. I > looked at the console log and the first one is undefined (as > expected), the second one is a proper NodeList smalltalk class, with > wrapped set to true, and the third one is a proper NativeCollection > with 2 subclasses. I also tried NativeCollection subclass: > #NodeListinstanceVariableNames: ''package: 'Kit-Native' at the end of > the file (which was the way it used to be) but then the resulting > class didn't have the wrapped attribute. > > So I'm stumped. Any ideas greatly appreciated. > > Thanks ../Dave > > ------ Kit-Native.st: > Smalltalk current createPackage: 'Kit-Native' ! > SequenceableCollection subclass: #NativeCollection > instanceVariableNames: '' > package: 'Kit-Native'! > > !NativeCollection class methodsFor: 'not yet classified'! > > wrap > < require(['amber_vm/smalltalk'],function(smalltalk) { > smalltalk.wrapClassName('HTMLCollection','Kit-Native',window.HTMLCollection,sma > console.log(smalltalk.NodeList); > smalltalk.wrapClassName('NodeList','Kit-Native',window.NodeList,smalltalk.NativeCollection,true); > console.log(smalltalk.NodeList); > console.log(smalltalk.NativeCollection); > }); > > ! ! > > !NativeCollection methodsFor: 'not yet classified'! > > first > <return self[0]> > ! > > size > <return self.length> > ! ! > ------ > > -- > 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/groups/opt_out. -- 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/groups/opt_out. |
Hi!
To wrap JS constructors, you can do the following (using a recent git version): MyClass class >> initialize self javascriptConstructor: aJavaScriptFunction See `Behavior >> javascriptConstructor:' and `smalltalk.setClassConstructor' in boot.js Cheers, Nico Herby Vojčík writes: > One of the new commits just a few days ago made wrapping foreign JS classes available to Smalltalk runtime, so no helper files with wrapClassName should be needed any more. Just browse through last ones in github. > > Dave Mason wrote: >> On Fri, Oct 11, 2013 at 5:36 AM, Herby Vojčík <[hidden email] >> <mailto:[hidden email]>> wrote: >> >> Dave Mason wrote: >> >> Could somebody either make the git head work, or provide >> instructions on >> how to set up the environment properly so this can all run. I >> found >> >> >> I wrote something to README.md and to Getting started wiki page. >> >> >> Bingo! Thanks. It was obvious that bower was involved somehow, but >> figuring out bower worked and integrated with amber was much less >> clear. But you've fixed that now. Much appreciated. >> >> Now I can get back the the "real" problem. :-) (I have attached a very >> short standalone program that exhibits the problem.) >> >> This used to work, but doesn't > now. (Note I don't want to use jQuery >> for what seem like good reasons.) I have code that does: >> (document getElementsByClassName: 'program') do: [ >> : program | >> ... >> ]. >> getElementsByClassName returns a NodeList, which used to complain do: >> needed first and size methods, so I created a NativeCollection in >> which I defined those, and did a wrapClassName on NodeList to make it >> a subclass of NativeCollection. I used to do this in a helper js file: >> ------ Kit-helper.js: >> smalltalk.wrapClassName("NodeList", "Kit-Native", NodeList, >> smalltalk.NativeCollection); >> smalltalk.wrapClassName("HTMLCollection", "Kit-Native", >> HTMLCollection, smalltalk.NativeCollection); >> ------ >> but it was a bit tricky to get the loading right for that and I wanted >> to put as much as possible in Smalltalk, so I put the wrapClassName in >> a class method (see below) for NativeCollection. At one level it >> works fine. The classes/methods look fine, but I get '[obje > ct >> NodeList] does not understand #do:' when the code above runs. I >> looked at the console log and the first one is undefined (as >> expected), the second one is a proper NodeList smalltalk class, with >> wrapped set to true, and the third one is a proper NativeCollection >> with 2 subclasses. I also tried NativeCollection subclass: >> #NodeListinstanceVariableNames: ''package: 'Kit-Native' at the end of >> the file (which was the way it used to be) but then the resulting >> class didn't have the wrapped attribute. >> >> So I'm stumped. Any ideas greatly appreciated. >> >> Thanks ../Dave >> >> ------ Kit-Native.st: >> Smalltalk current createPackage: 'Kit-Native' ! >> SequenceableCollection subclass: #NativeCollection >> instanceVariableNames: '' >> package: 'Kit-Native'! >> >> !NativeCollection class methodsFor: 'not yet classified'! >> >> wrap >> < require(['amber_vm/smalltalk'],function(smalltalk) { >> smalltalk.wrapClassName('HTMLCollection','Kit-Native',window.HTMLCollection,sma > lltalk.NativeCollection); >> console.log(smalltalk.NodeList); >> smalltalk.wrapClassName('NodeList','Kit-Native',window.NodeList,smalltalk.NativeCollection,true); >> console.log(smalltalk.NodeList); >> console.log(smalltalk.NativeCollection); >> }); > >> ! ! >> >> !NativeCollection methodsFor: 'not yet classified'! >> >> first >> <return self[0]> >> ! >> >> size >> <return self.length> >> ! ! >> ------ >> >> -- >> 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/groups/opt_out. -- Nicolas Petton http://nicolas-petton.fr -- 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/groups/opt_out. |
Hi Nico, I put this into the Amber wiki here: Best, Manfred On Tue, Oct 22, 2013 at 12:45 AM, Nicolas Petton <[hidden email]> wrote: Hi! 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/groups/opt_out. |
Good idea :)
Nico Manfred Kröhnert writes: > Hi Nico, > > I put this into the Amber wiki here: > > https://github.com/amber-smalltalk/amber/wiki/Wrapping-javascript-constructors-recipe > > Best, > Manfred > > > > > On Tue, Oct 22, 2013 at 12:45 AM, Nicolas Petton > <[hidden email]>wrote: > >> Hi! >> >> To wrap JS constructors, you can do the following (using a recent git >> version): >> >> MyClass class >> initialize >> self javascriptConstructor: aJavaScriptFunction >> >> See `Behavior >> javascriptConstructor:' and >> `smalltalk.setClassConstructor' in boot.js >> >> Cheers, >> Nico >> >> Herby Vojčík writes: >> >> > One of the new commits just a few days ago made wrapping foreign JS >> classes available to Smalltalk runtime, so no helper files with >> wrapClassName should be needed any more. Just browse through last ones in >> github. >> > >> > Dave Mason wrote: >> >> On Fri, Oct 11, 2013 at 5:36 AM, Herby Vojčík <[hidden email] >> >> <mailto:[hidden email]>> wrote: >> >> >> >> Dave Mason wrote: >> >> >> >> Could somebody either make the git head work, or provide >> >> instructions on >> >> how to set up the environment properly so this can all run. I >> >> found >> >> >> >> >> >> I wrote something to README.md and to Getting started wiki page. >> >> >> >> >> >> Bingo! Thanks. It was obvious that bower was involved somehow, but >> >> figuring out bower worked and integrated with amber was much less >> >> clear. But you've fixed that now. Much appreciated. >> >> >> >> Now I can get back the the "real" problem. :-) (I have attached a very >> >> short standalone program that exhibits the problem.) >> >> >> >> This used to work, but doesn't >> > now. (Note I don't want to use jQuery >> >> for what seem like good reasons.) I have code that does: >> >> (document getElementsByClassName: 'program') do: [ >> >> : program | >> >> ... >> >> ]. >> >> getElementsByClassName returns a NodeList, which used to complain do: >> >> needed first and size methods, so I created a NativeCollection in >> >> which I defined those, and did a wrapClassName on NodeList to make it >> >> a subclass of NativeCollection. I used to do this in a helper js file: >> >> ------ Kit-helper.js: >> >> smalltalk.wrapClassName("NodeList", "Kit-Native", NodeList, >> >> smalltalk.NativeCollection); >> >> smalltalk.wrapClassName("HTMLCollection", "Kit-Native", >> >> HTMLCollection, smalltalk.NativeCollection); >> >> ------ >> >> but it was a bit tricky to get the loading right for that and I wanted >> >> to put as much as possible in Smalltalk, so I put the wrapClassName in >> >> a class method (see below) for NativeCollection. At one level it >> >> works fine. The classes/methods look fine, but I get '[obje >> > ct >> >> NodeList] does not understand #do:' when the code above runs. I >> >> looked at the console log and the first one is undefined (as >> >> expected), the second one is a proper NodeList smalltalk class, with >> >> wrapped set to true, and the third one is a proper NativeCollection >> >> with 2 subclasses. I also tried NativeCollection subclass: >> >> #NodeListinstanceVariableNames: ''package: 'Kit-Native' at the end of >> >> the file (which was the way it used to be) but then the resulting >> >> class didn't have the wrapped attribute. >> >> >> >> So I'm stumped. Any ideas greatly appreciated. >> >> >> >> Thanks ../Dave >> >> >> >> ------ Kit-Native.st: >> >> Smalltalk current createPackage: 'Kit-Native' ! >> >> SequenceableCollection subclass: #NativeCollection >> >> instanceVariableNames: '' >> >> package: 'Kit-Native'! >> >> >> >> !NativeCollection class methodsFor: 'not yet classified'! >> >> >> >> wrap >> >> < require(['amber_vm/smalltalk'],function(smalltalk) { >> >> >> smalltalk.wrapClassName('HTMLCollection','Kit-Native',window.HTMLCollection,sma >> > lltalk.NativeCollection); >> >> console.log(smalltalk.NodeList); >> >> >> smalltalk.wrapClassName('NodeList','Kit-Native',window.NodeList,smalltalk.NativeCollection,true); >> >> console.log(smalltalk.NodeList); >> >> console.log(smalltalk.NativeCollection); >> >> }); > >> >> ! ! >> >> >> >> !NativeCollection methodsFor: 'not yet classified'! >> >> >> >> first >> >> <return self[0]> >> >> ! >> >> >> >> size >> >> <return self.length> >> >> ! ! >> >> ------ >> >> >> >> -- >> >> 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/groups/opt_out. >> >> >> -- >> Nicolas Petton >> http://nicolas-petton.fr >> >> -- >> 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/groups/opt_out. >> -- Nicolas Petton http://nicolas-petton.fr -- 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/groups/opt_out. |
Free forum by Nabble | Edit this page |