[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] Creating new instance variables in a dynamically create
From: |
Mark Bratcher |
Subject: |
[Help-smalltalk] Creating new instance variables in a dynamically created class in gst-remote |
Date: |
Sat, 5 Sep 2015 13:24:54 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
Hello
I have an application I'm building in which some classes get created
dynamically by a piece of code, which we'll call "maker.st". I create an
image file by executing `gst -I seaside.im`, loading `maker.st`,
executing the code, and saving a new image file which includes Seaside.
We'll call this "maker.im". This is done with the following command:
gst -I seaside.im maker.st
So `maker.st` creates some classes, and then writes a `maker.im` image
(using `objectMemory snapshot: 'maker.im'`) after they've been created.
I want my Seaside application, which consists of a number of smalltalk
source files put into a package "MyApp", to be able to extend and use
these dynamically created classes. So the running of gst-remote looks
like this:
gst-remote -I maker.im --daemon --start=Seaside > tcob.log 2>&1
sleep 1
gst-remote --package=MyApp
Thus far, it's worked pretty well. I've been able to `extend` the
dynamically created classes and add selectors (at class and metaclass
level).
However, as soon as I included instance variable declarations in my
extensions, I hit this error when I attempt to run the server and
application:
gst-remote -I maker.im --daemon --start=Seaside > tcob.log 2>&1
sleep 1
gst-remote --package=MyApp
error: did not understand #statements
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
STInST.RBVariableNode(Object)>>doesNotUnderstand: #statements
(SysExcept.st:1448)
STInST.GSTFileInParser(STInST.STFileParser)>>evaluate:
(Parser.star#VFS.ZipFile/STFileParser.st:111)
STInST.GSTFileInParser>>evaluate:
(Parser.star#VFS.ZipFile/GSTParser.st:377)
STInST.GSTFileInParser(STInST.STFileParser)>>resolveClass:
(Parser.star#VFS.ZipFile/STFileParser.st:101)
STInST.GSTFileInParser>>parseInstanceVariables:add:
(Parser.star#VFS.ZipFile/GSTParser.st:332)
STInST.GSTFileInParser>>parseClassBodyElement:withinExtend:
(Parser.star#VFS.ZipFile/GSTParser.st:234)
STInST.GSTFileInParser>>parseClassBody:
(Parser.star#VFS.ZipFile/GSTParser.st:169)
STInST.GSTFileInParser>>parseClassExtension:
(Parser.star#VFS.ZipFile/GSTParser.st:147)
STInST.GSTFileInParser>>parseDeclaration:
(Parser.star#VFS.ZipFile/GSTParser.st:98)
STInST.GSTFileInParser>>parseDoit
(Parser.star#VFS.ZipFile/GSTParser.st:82)
STInST.GSTFileInParser>>parseDoits
(Parser.star#VFS.ZipFile/GSTParser.st:67)
STInST.GSTFileInParser(STInST.STFileInParser)>>parseSmalltalk
(Parser.star#VFS.ZipFile/STFileParser.st:282)
STInST.GSTFileInParser class(STInST.STFileParser
class)>>parseSmalltalkStream:with:onError:
(Parser.star#VFS.ZipFile/STFileParser.st:70)
STInST.GSTFileInParser class(STInST.STFileParser
class)>>parseSmalltalkStream:with:
(Parser.star#VFS.ZipFile/STFileParser.st:60)
STInST.STEvaluationDriver(STInST.STParsingDriver)>>parseSmalltalkStream:with:
(Parser.star#VFS.ZipFile/STFileParser.st:181)
optimized [] in Stream>>fileInLine:file:at:
(Compiler.star#VFS.ZipFile/StartCompiler.st:69)
BlockClosure>>ensure: (BlkClosure.st:268)
Kernel.LimitedStream(Stream)>>fileInLine:file:at:
(Compiler.star#VFS.ZipFile/StartCompiler.st:65)
Kernel.LimitedStream(Stream)>>fileInLine:file:fileName:at:
(Compiler.star#VFS.ZipFile/StartCompiler.st:76)
Kernel.LimitedStream>>fileIn (VFSZip.st:352)
optimized [] in FilePath>>fileIn (FilePath.st:665)
[] in VFS.StoredZipMember(FilePath)>>withReadStreamDo: (FilePath.st:658)
BlockClosure>>ensure: (BlkClosure.st:268)
VFS.StoredZipMember(FilePath)>>withReadStreamDo: (FilePath.st:657)
VFS.StoredZipMember(FilePath)>>fileIn (FilePath.st:665)
optimized [] in Package>>primFileIn (PkgLoader.st:1574)
OrderedCollection>>do: (OrderColl.st:67)
[] in Package>>primFileIn (PkgLoader.st:1574)
BlockClosure>>ensure: (BlkClosure.st:268)
Package>>primFileIn (PkgLoader.st:1560)
Kernel.StarPackage>>primFileIn (PkgLoader.st:1078)
optimized [] in PackageLoader class>>fileInPackages: (PkgLoader.st:1973)
OrderedCollection>>do: (OrderColl.st:67)
PackageLoader class>>fileInPackages: (PkgLoader.st:1966)
PackageLoader class>>fileInPackage: (PkgLoader.st:1954)
UndefinedObject>>executeStatements (a String:1)
[] in STInST.STEvaluationDriver>>evaluate:
(Parser.star#VFS.ZipFile/STEvaluationDriver.st:210)
I narrowed it down specifically to the instance variable declarations.
If I simply add these declarations and nothing else, I get the error.
I'm adding instance variables using the common approach:
MyClass extend [
| newVariable | "Remove this, the error goes away"
... "Various selectors added for extension"
]
How can we figure out why this error occurs? I can try to put together a
very minimal Seaside app to reproduce it in that context if needed.
Thanks
Mark
- [Help-smalltalk] Creating new instance variables in a dynamically created class in gst-remote,
Mark Bratcher <=