VAST-style Compile-time constants

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

VAST-style Compile-time constants

Bob Hartwig
Hi all,

I'm investigating the feasibility of porting a large VAST application to Pharo, so I may have some questions in the coming days.  Here's my first question:

VAST has the concept of compile-time constants, using the ##() syntax.  Whatever is in the parentheses is evaluated at compile time, and the result is stored, so the evaluation does not need to happen again when the method is sent later.  E.g., when this method is sent:

printTheNumberToTheTranscript

    Transcript nextPutAll: ##( 10 factorial asString ) .

no calculation or string conversion is necessary, because 10 factorial asString was evaluated at compile time and the answer was stored.  Please note that this is different from array literals, which is how Pharo seems to treat this syntax.

As far as I can tell, Pharo does not have this feature (certainly not with that syntax), but I would love to be proved wrong.  Am I?  Does anyone else have words of wisdom regarding porting a VAST app to Pharo?  Any other language features that are missing? I'm not too concerned about Pragmas, and this app has no GUI, so I'm not concerned about UI framework differences.

    Thanks,
    Bob Hartwig

Reply | Threaded
Open this post in threaded view
|

Re: VAST-style Compile-time constants

Mariano Martinez Peck


On Tue, Nov 27, 2012 at 12:54 AM, Bob Hartwig <[hidden email]> wrote:
Hi all,

I'm investigating the feasibility of porting a large VAST application to Pharo, so I may have some questions in the coming days.  Here's my first question:

VAST has the concept of compile-time constants, using the ##() syntax.  Whatever is in the parentheses is evaluated at compile time, and the result is stored, so the evaluation does not need to happen again when the method is sent later.  E.g., when this method is sent:

printTheNumberToTheTranscript

    Transcript nextPutAll: ##( 10 factorial asString ) .

no calculation or string conversion is necessary, because 10 factorial asString was evaluated at compile time and the answer was stored.  Please note that this is different from array literals, which is how Pharo seems to treat this syntax.

As far as I can tell, Pharo does not have this feature (certainly not with that syntax), but I would love to be proved wrong.  Am I?

Yes, it has it also. The array is stored as a literal in the compiled method.....I think the sintax was with only one #, like:  #(10 factorial asString)

can you try?
 
 Does anyone else have words of wisdom regarding porting a VAST app to Pharo?  Any other language features that are missing? I'm not too concerned about Pragmas, and this app has no GUI, so I'm not concerned about UI framework differences.

    Thanks,
    Bob Hartwig




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: VAST-style Compile-time constants

Mariano Martinez Peck
In reply to this post by Bob Hartwig


On Tue, Nov 27, 2012 at 12:54 AM, Bob Hartwig <[hidden email]> wrote:
Hi all,

I'm investigating the feasibility of porting a large VAST application to Pharo, so I may have some questions in the coming days.  Here's my first question:

VAST has the concept of compile-time constants, using the ##() syntax.  Whatever is in the parentheses is evaluated at compile time, and the result is stored, so the evaluation does not need to happen again when the method is sent later.  E.g., when this method is sent:

printTheNumberToTheTranscript

    Transcript nextPutAll: ##( 10 factorial asString ) .

no calculation or string conversion is necessary, because 10 factorial asString was evaluated at compile time and the answer was stored.  Please note that this is different from array literals, which is how Pharo seems to treat this syntax.

As far as I can tell, Pharo does not have this feature (certainly not with that syntax), but I would love to be proved wrong.  Am I?  Does anyone else have words of wisdom regarding porting a VAST app to Pharo?  Any other language features that are missing?

Not that I know. The first step is to fileout or somehow get the code from ENVY. Then start importing in Pharo. It would help if the app has tests in which case I recommend start porting the tests.
 
I'm not too concerned about Pragmas, and this app has no GUI, so I'm not concerned about UI framework differences.


Pragmas are used in Pharo for more things than just UI. Anyway, Pragmas do also exist in VAST. Finally, I was going to say that the most complicated part of the port would be the UI, but if there is none, then easier. 
Do you have a database? which frameworks/libraries do you use from VAST?
 
    Thanks,
    Bob Hartwig




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: VAST-style Compile-time constants

Stéphane Ducasse
In reply to this post by Bob Hartwig
Hi bob

Why could be done is to extend the compiler (marcus did that in the past) to have compile time evaluation.
Now how many times such feature is used in your application?

Stef

> printTheNumberToTheTranscript
>
>     Transcript nextPutAll: ##( 10 factorial asString ) .
>
> no calculation or string conversion is necessary, because 10 factorial asString was evaluated at compile time and the answer was stored.  Please note that this is different from array literals, which is how Pharo seems to treat this syntax.
>
> As far as I can tell, Pharo does not have this feature (certainly not with that syntax), but I would love to be proved wrong.  Am I?  

No
it does not.

> Does anyone else have words of wisdom regarding porting a VAST app to Pharo?  Any other language features that are missing?
Not really
Did you check the float precision?

> I'm not too concerned about Pragmas, and this app has no GUI, so I'm not concerned about UI framework differences.

Do not hesitate to let us know the problem you encounter.

>
>     Thanks,
>     Bob Hartwig
>


Reply | Threaded
Open this post in threaded view
|

Re: VAST-style Compile-time constants

Mariano Martinez Peck
In reply to this post by Mariano Martinez Peck


On Tue, Nov 27, 2012 at 9:04 AM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, Nov 27, 2012 at 12:54 AM, Bob Hartwig <[hidden email]> wrote:
Hi all,

I'm investigating the feasibility of porting a large VAST application to Pharo, so I may have some questions in the coming days.  Here's my first question:

VAST has the concept of compile-time constants, using the ##() syntax.  Whatever is in the parentheses is evaluated at compile time, and the result is stored, so the evaluation does not need to happen again when the method is sent later.  E.g., when this method is sent:

printTheNumberToTheTranscript

    Transcript nextPutAll: ##( 10 factorial asString ) .

no calculation or string conversion is necessary, because 10 factorial asString was evaluated at compile time and the answer was stored.  Please note that this is different from array literals, which is how Pharo seems to treat this syntax.

As far as I can tell, Pharo does not have this feature (certainly not with that syntax), but I would love to be proved wrong.  Am I?

Yes, it has it also. The array is stored as a literal in the compiled method.....I think the sintax was with only one #, like:  #(10 factorial asString)

can you try?
 


uffff I should not answer emails before waking up....what I say is only for some kind of objects, not expressions. So, no, you don't have it out of the box. 
 
 Does anyone else have words of wisdom regarding porting a VAST app to Pharo?  Any other language features that are missing? I'm not too concerned about Pragmas, and this app has no GUI, so I'm not concerned about UI framework differences.

    Thanks,
    Bob Hartwig




--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com