Re: Using dotted notation in expressions

"Konstantin L. Metlov" <[email protected]> Thu, 15 Aug 2002 19:55:36 +0200 (CEST)
Newsgroups gmane.comp.java.jel.general
Message-ID <[email protected]>
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to [email protected] for more info.

---409784806-1876669138-1029434048=:26013
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <[email protected]>

Hello !

Sorry for my silence, I was a little bit distracted by the floods in
Prague...

I still have a problem with the code, since I do not understand clearly --
what you actually want to do. I have modified your files (the changes are
highlighted in the attached diff) to make an expression to correspond to
the gnu.jel.Library initialization you've done, being pretty much sure
that the result is not what you want.

The point is that the methods of the classes supplied to the first two 
arguments of the Library constructur are defined in the _root_ of the 
namespace. Their fields/methods will be accessible without dot operator, 
which is the change described in the attached diff.

In order to use the 'dot' operator you need to either have the root
context containing the fields/methods whose value/return type is a
non-primitive class (on which you would cast the dot operator in an
expression), or, you need to define the "dynamic variables" (see
corresponding section of JEL manual) whose type is a non-primitive class.

Which of the above possibilities to use depends on the answer to the 
following question:

Will the number of root variables change during the program runtime ?

If the set of root variables is fixed, adding them to one of the classes, 
supplied as a first arguments of the Library constructor will provide the 
highest performance. If you plan to add variables during run-time the 
"dynamic variables" will allow such flexibility at a cost of somewhat 
lower performance.

I hope this answers your question, if not -- please ask.

With the best regards,
                        Konstantin.


On Fri, 9 Aug 2002, Prem Lall wrote:

> 
> Hi Konstantin,
> Thanks for your reply.
> As you indicated, I believe problem is related to improper library
> initialization ...
> The easiest thing for me to do is send you my test code so that you could
> tell what I am doing wrong.
> Thanks in advance.
> 
> (See attached file: PTFResult.java)(See attached file: JelTest.java)
> 
> Prem Lall
> BMF E-File Project Team
> 800 North Frederick Road
> Gaithersburg,  MD  20879
> [email protected]
> "The needs of the business outweigh the needs of the few"
> "Pressure turns coal into diamonds"

---409784806-1876669138-1029434048=:26013
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="jeltest.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <[email protected]>
Content-Description: jeltest.diff
Content-Disposition: ATTACHMENT; FILENAME="jeltest.diff"

T25seSBpbiBqZWx0ZXN0LzogSmVsVGVzdC5jbGFzcw0KZGlmZiAtYyBqZWx0
ZXN0Lm9yaWcvSmVsVGVzdC5qYXZhIGplbHRlc3QvSmVsVGVzdC5qYXZhDQoq
KiogamVsdGVzdC5vcmlnL0plbFRlc3QuamF2YQlUaHUgQXVnIDE1IDE5OjM1
OjEyIDIwMDINCi0tLSBqZWx0ZXN0L0plbFRlc3QuamF2YQlNb24gQXVnIDEy
IDE4OjAzOjI5IDIwMDINCioqKioqKioqKioqKioqKg0KKioqIDM0LDQwICoq
KioNCiAgCQ0KICAJLy9TdHJpbmcgZXhwciA9ICJcImFiY1wiLmxlbmd0aCgp
PT0zIjsNCiAgCQ0KISAJU3RyaW5nIGV4cHIgPSAidmFyaWFibGVzLmdldElz
VmFsaWQoKT09dHJ1ZSI7CQ0KICAgICAgQ29tcGlsZWRFeHByZXNzaW9uIGV4
cHJfYz1udWxsOw0KICAgICAgdHJ5IHsNCiAgICAgICAgZXhwcl9jPUV2YWx1
YXRvci5jb21waWxlKGV4cHIsbGliKTsNCi0tLSAzNCw0MSAtLS0tDQogIAkN
CiAgCS8vU3RyaW5nIGV4cHIgPSAiXCJhYmNcIi5sZW5ndGgoKT09MyI7DQog
IAkNCiEgCVN0cmluZyBleHByID0gImlzVmFsaWQoKT09dHJ1ZSI7CQkNCiEg
Ly8JU3RyaW5nIGV4cHIgPSAidmFyaWFibGVzLmdldElzVmFsaWQoKT09dHJ1
ZSI7CQ0KICAgICAgQ29tcGlsZWRFeHByZXNzaW9uIGV4cHJfYz1udWxsOw0K
ICAgICAgdHJ5IHsNCiAgICAgICAgZXhwcl9jPUV2YWx1YXRvci5jb21waWxl
KGV4cHIsbGliKTsNCioqKioqKioqKioqKioqKg0KKioqIDY4LDc0ICoqKioN
CiAgICAgICAgLy8gRXZhbHVhd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