What is the meaning of the <primitive: lines> and do we prefer implementing stuff in Smalltalk or latching on Java.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

What is the meaning of the <primitive: lines> and do we prefer implementing stuff in Smalltalk or latching on Java.

kabelo moiloa
In some of the source files, I see lines like this <primitive: 110>, what do these lines mean, where are they implemented? Also when we implement something like Dictionary, can we use java.util.HashMap or do we roll our own.

--
You received this message because you are subscribed to the Google Groups "Redline Smalltalk" 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.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: What is the meaning of the <primitive: lines> and do we prefer implementing stuff in Smalltalk or latching on Java.

kabelo moiloa
Ignore this accidental duplicate post.

On Monday, February 25, 2013 4:29:22 PM UTC+4, kabelo moiloa wrote:
In some of the source files, I see lines like this <primitive: 110>, what do these lines mean, where are they implemented? Also when we implement something like Dictionary, can we use java.util.HashMap or do we roll our own.

--
You received this message because you are subscribed to the Google Groups "Redline Smalltalk" 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.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: What is the meaning of the <primitive: lines> and do we prefer implementing stuff in Smalltalk or latching on Java.

James Ladd
In reply to this post by kabelo moiloa
Q1: <primitive: 110> is the Smalltalk-80 form for saying the expression is implemented by a primitive in the virtual machine.
All the method arguments and current context are passed to the primitive method.

The primitive methods are those methods in PrimObject that start with p followed by a number. For example:

    public PrimObject p110(PrimObject receiver, PrimContext context) {
        // ==
        return receiver.equals(context.argumentAt(0)) ? PrimObject.TRUE : PrimObject.FALSE;
    }

To add a new primitive (which there should be a special reason for) you simply create a new
pNN method. The convention is to comment the first line of the primitive with the selector it implements. In the case above
that selector is '=='

Q2: Use Java or Roll our own

Given the specific example of Dictionary there would be a class that implements the protocol of Dictionary as defined by
Smalltalk-80, however, the backing object (javaValue) would be a HashMap. This approach ensures the object people deal
with looks and feels like a proper Smalltalk object even though it uses a Java object underneath.


On Mon, Feb 25, 2013 at 11:29 PM, kabelo moiloa <[hidden email]> wrote:
In some of the source files, I see lines like this <primitive: 110>, what do these lines mean, where are they implemented? Also when we implement something like Dictionary, can we use java.util.HashMap or do we roll our own.

--
You received this message because you are subscribed to the Google Groups "Redline Smalltalk" 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 "Redline Smalltalk" 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.
 
 
Loading...