GemStone compiler errors

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

GemStone compiler errors

lautarox
Hi everyone, I've just registered here, I'm learning Object Orienting Programming in the University of Buenos Aires and we are playing a bit with GemStone and Pharo (we are developing in Pharo and deploying in GemStone).
The work that I'm doing involves the use of the compiler. As we knew, the Pharo compiler is not the same as the GemStone one (and some other things that we are working to get them going), and we are getting errors that we are not really sure why they happen or where to look for a reference of what's going on.
We are compiling methods like this:
('methodName', String cr, '^1')  _compileInContext: nil symbolList: (GsCurrentSession currentSession symbolList)
And we are getting an "unexpected token" CompileError 1001.
I would love to have some insight on how the GemStone compiler works, is there any documentation you would recommend?

Thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: GemStone compiler errors

BrunoBB
hi  lautarox,

Using GemStone 3.3.0 and using double quotes worked for me:

('''methodName', String lf, ' ^1''') _compileInContext: nil symbolList: (GsCurrentSession currentSession symbolList).

regards,
bruno
Reply | Threaded
Open this post in threaded view
|

Re: GemStone compiler errors

lautarox
Hi Bruno,
Thanks for you reply. Why is it needed to have the method surrounded by ''?
Also, I couldn't find any non hacky way of doing the "anObject withArgs: argArray executeMethod: compiledMethod" that Pharo has. I haven't found any way of doing a method execution with a variable number of arguments, all I find are fixed ones, do you know any way of executing a method like that?

Thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: GemStone compiler errors

GLASS mailing list
In reply to this post by BrunoBB

Bruno,

If those are double quotes then you are compiling a comment, and that would never have a compiler error. If those are two single quotes then you are compiling code that might answer a string, that would not error either. Neither would compile to a method though.

Lautarox,

I don't have an environment to see the code and test this right now, but I might be able to get you looking in the right direction.

You are compiling a method for what class? I suspect that if context is nil then you should remove methodName from the source code. nil context would be a doit method that might not be expected to be added to the methodDictionary of a class. The compiler code might even add a #doit method name to the source code if nil context.

It is not normal to have to call private methods that start with an underscore. You might look at senders to see if there is a public method that does what you want. I know, many times the public methods do not exist for what you need.


On Nov 23, 2016 9:06 AM, "BrunoBB via Glass" <[hidden email]> wrote:
hiĀ  lautarox,

Using GemStone 3.3.0 and using double quotes worked for me:

('''methodName', String lf, ' ^1''') _compileInContext: nil symbolList:
(GsCurrentSession currentSession symbolList).

regards,
bruno



--
View this message in context: http://forum.world.st/GemStone-compiler-errors-tp4924387p4924396.html
Sent from the GLASS mailing list archive at Nabble.com.
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: GemStone compiler errors

BrunoBB
In reply to this post by lautarox
lautarox,

Well all Smalltalk compiler are different (there is no standart) and very related to specifics of the VM.
For example in Dolphin Smalltalk you have:
##(<static expression>)
To tell the compiler this is a fixed value and always return the same value (without evaluating each time).

In GemStone (and all Smalltalks) double single quotes are used to represent single quotes inside a string.
For example:
'3' evaluate. "answer anInteger"

But how to evaluate a String ? --> double single quotes
'''3''' evaluate. "answer a String"

A for the other question, what do you want to achieve ?

You have a lot of messages in GemStone (Object class):
#perform:withArguments:

But do you want to execute a aGsMethod ?

regards,
bruno
Reply | Threaded
Open this post in threaded view
|

Re: GemStone compiler errors

GLASS mailing list
In reply to this post by lautarox

I suspect there is a much easier way to solve whatever the problem is. I'd have to know what you are trying to do though.

For example, instead of compiling code each time you might have previously compiled methods that answer a BlockClosure that you then evaluate with any arguments.

Blocks and methods have a fixed number of arguments. It is nearly always appropriate to pass a collection of things as one of the arguments. If you really do need code that handles a variable number of arguments then you'd use basically a case statement that would use the correct private block or method for the arguments passed. Such a case statement is very rare though.


On Nov 24, 2016 3:03 PM, "lautarox via Glass" <[hidden email]> wrote:
Hi Bruno,
Thanks for you reply. Why is it needed to have the method surrounded by ''?
Also, I couldn't find any non hacky way of doing the "anObject withArgs:
argArray executeMethod: compiledMethod" that Pharo has. I haven't found any
way of doing a method execution with a variable number of arguments, all I
find are fixed ones, do you know any way of executing a method like that?

Thanks again.




--
View this message in context: http://forum.world.st/GemStone-compiler-errors-tp4924387p4924633.html
Sent from the GLASS mailing list archive at Nabble.com.
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass