pb with multi signature function in startup ?

Hi,

I use for a while now an XMLDocument library (https://github.com/domoran/dxlstdlib/tree/master/lib) made by Mathias Mamsch.

No pb...

I decided to load this library in the startup : No pb as well.... apparently:

Now an other dxl file that used the XMLDocument library does  not compile anymore. I obtained  this error :

incorrect use of identifier (appendTag)

I reproduced that with other kind of dxl file I loaded in the startup, and it seems that it happens when there is the same function name in the dxl loaded at top level with different signatures (example XMLTag appendTag (XMLTag, string); XMLTag appendTag (XMLDocument, string)...)

Does it sound familiar to someone ?

Does someone know the list of characteristics a DXL file to be loaded in the startup must comply to ?

Thanks for your help.

Joseph.


jaracic - Mon Oct 10 17:55:05 EDT 2016

Re: pb with multi signature function in startup ?
Mathias Mamsch - Tue Oct 11 03:37:30 EDT 2016

Yes, this is a familiar problem. I would not recomment loading your own (or mine :-)) librararies at startup to the Top Level DXL context. Why do you think you need to do that? 

You got two options: 

- Explicitly hint the parser to which function you want to use (cumbersome, requires changes in all DXL scripts). You would do this by explicitly giving the parameter type at the calling function, e.g.

appendTag(myVar XMLDocument, "test");

Usually this can resolve the syntax error, but as I said not the preferred way to go. 

- Prefix all global variables and functions inside the top level library (i.e. rename them), so there are no conflicts anymore. 

Global_XMLTag Global_appendTag (Global_XMLDocument, string) { ... }

Also not the best way obviously. 

- Avoid loading the library twice. Again: Why do you need to have the library loaded at startup? 

Regards, Mathias

Re: pb with multi signature function in startup ?
jaracic - Tue Oct 11 08:20:23 EDT 2016

Mathias Mamsch - Tue Oct 11 03:37:30 EDT 2016

Yes, this is a familiar problem. I would not recomment loading your own (or mine :-)) librararies at startup to the Top Level DXL context. Why do you think you need to do that? 

You got two options: 

- Explicitly hint the parser to which function you want to use (cumbersome, requires changes in all DXL scripts). You would do this by explicitly giving the parameter type at the calling function, e.g.

appendTag(myVar XMLDocument, "test");

Usually this can resolve the syntax error, but as I said not the preferred way to go. 

- Prefix all global variables and functions inside the top level library (i.e. rename them), so there are no conflicts anymore. 

Global_XMLTag Global_appendTag (Global_XMLDocument, string) { ... }

Also not the best way obviously. 

- Avoid loading the library twice. Again: Why do you need to have the library loaded at startup? 

Regards, Mathias

Thank you, 

Actually I wanted to load some libraries in startup in order to have them available in view layout dxl and also in eval_ I call very frequently (to avoid string table expansion due to numerous XML Calls/Responses strings within the context of a XML-RPC interface).

I wanted to avoid loading the XML library each time (performance of the buit-in XML perms are not fantastic, and functionnaly quite limited) and the library that encapsulates it to provide a comprehensive API for a web application (Actually TestLink).

Actually I'm facing to a real performance issue since a typical "TestLink" interaction could imply more that 10000 XML RPC calls. If I add to that strings table expansions due to the log management (very verbose one...), it is just a nightmare in term of performances.

 

Mathias, could you explain the reason behind your " I would not recommend loading your ... libraries at startup..." ? except the issue of global variable management "mutability" aspects.

Thanks.

Joseph

 

 

 

Re: pb with multi signature function in startup ?
Mathias Mamsch - Tue Oct 11 11:49:31 EDT 2016

jaracic - Tue Oct 11 08:20:23 EDT 2016

Thank you, 

Actually I wanted to load some libraries in startup in order to have them available in view layout dxl and also in eval_ I call very frequently (to avoid string table expansion due to numerous XML Calls/Responses strings within the context of a XML-RPC interface).

I wanted to avoid loading the XML library each time (performance of the buit-in XML perms are not fantastic, and functionnaly quite limited) and the library that encapsulates it to provide a comprehensive API for a web application (Actually TestLink).

Actually I'm facing to a real performance issue since a typical "TestLink" interaction could imply more that 10000 XML RPC calls. If I add to that strings table expansions due to the log management (very verbose one...), it is just a nightmare in term of performances.

 

Mathias, could you explain the reason behind your " I would not recommend loading your ... libraries at startup..." ? except the issue of global variable management "mutability" aspects.

Thanks.

Joseph

 

 

 

Well, where should I start .

The first problem is, that modifying the startup files is a client specific change (that you would need to roll out to other users PCs).

The second problem is the namespacing (global vs. local DXL context).

The third is scoping: When ever a global DXL context function is called from a local DXL context, it must not store certain data (which will be invalidated, when the local DXL context ends)

The third is probably your worst nightmare giving you a lot of crashes. 

Regarding performance: 

- The XML library I posted is not suited for handling large XML data - due to the fact that the COM interface of DXL will ALWAYS persist stringtable entries. With large data you are talking 1 million calls, thousands will probably no problem. 

- Why would you call XML functions from a layout DXL? Layout DXL is only for displaying data, you should never do complicated evaluations from a layout DXL!

-> if you cannot get away with an attribute DXL, you should use a GUI backed Layout DXL - in which case you would calculate all entries inside one script and access the data from the layout DXL to display it. 

If you need to know more about that approach, ping back here, I made a basic post about this on the forum here: 

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014890784#77777777-0000-0000-0000-000014891453

Regards, Mathias

Re: pb with multi signature function in startup ?
jaracic - Wed Oct 12 08:55:07 EDT 2016

Mathias Mamsch - Tue Oct 11 11:49:31 EDT 2016

Well, where should I start .

The first problem is, that modifying the startup files is a client specific change (that you would need to roll out to other users PCs).

The second problem is the namespacing (global vs. local DXL context).

The third is scoping: When ever a global DXL context function is called from a local DXL context, it must not store certain data (which will be invalidated, when the local DXL context ends)

The third is probably your worst nightmare giving you a lot of crashes. 

Regarding performance: 

- The XML library I posted is not suited for handling large XML data - due to the fact that the COM interface of DXL will ALWAYS persist stringtable entries. With large data you are talking 1 million calls, thousands will probably no problem. 

- Why would you call XML functions from a layout DXL? Layout DXL is only for displaying data, you should never do complicated evaluations from a layout DXL!

-> if you cannot get away with an attribute DXL, you should use a GUI backed Layout DXL - in which case you would calculate all entries inside one script and access the data from the layout DXL to display it. 

If you need to know more about that approach, ping back here, I made a basic post about this on the forum here: 

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014890784#77777777-0000-0000-0000-000014891453

Regards, Mathias

Hi, 

First of all Thank you for your help.

- Why would you call XML functions from a layout DXL? Layout DXL is only for displaying data, you should never do complicated evaluations from a layout DXL!

Actually I don't need an XML library in DXL layout. Typically in a DXL layout I could need in startup some global variable and high level utilities functions (simple calculations, navigations, formatting...etc.)

 

I just tested you previous response to avoid the "incorrect use of identifier" error, by explicitly indicating the parameter type.

below an extract of my DXL code:

rootStructTag = (XMLTag appendTag(parentTag XMLTag, SERIALIZE_STRUCT string))

And I still have the error :

incorrect use of identifier (appendTag)

It's why I made an other test, by executing the following code (XMLDocument.inc is loaded in startup) :

XMLDocument xdoc = create_XMLDocument

XMLTag tag = appendTag(xdoc XMLDocument, "toto" string)

delete_XMLDocument xdoc

...and no error !

It's why I'm wondering what the "incorrect use of identifier (appendTag)" error, means exactly ?

Obviously something in my code (the one in the local dxl context)  interferes ....

I firstly though it was because I have in my code (local context) some other appendTag perms (with different signature of course), but I faced the same kind of problem with an other function name that have only one signature...

any help to find approach to investigate would be appreciated.

Kind regards.

Re: pb with multi signature function in startup ?
jaracic - Fri Oct 14 07:20:36 EDT 2016

jaracic - Wed Oct 12 08:55:07 EDT 2016

Hi, 

First of all Thank you for your help.

- Why would you call XML functions from a layout DXL? Layout DXL is only for displaying data, you should never do complicated evaluations from a layout DXL!

Actually I don't need an XML library in DXL layout. Typically in a DXL layout I could need in startup some global variable and high level utilities functions (simple calculations, navigations, formatting...etc.)

 

I just tested you previous response to avoid the "incorrect use of identifier" error, by explicitly indicating the parameter type.

below an extract of my DXL code:

rootStructTag = (XMLTag appendTag(parentTag XMLTag, SERIALIZE_STRUCT string))

And I still have the error :

incorrect use of identifier (appendTag)

It's why I made an other test, by executing the following code (XMLDocument.inc is loaded in startup) :

XMLDocument xdoc = create_XMLDocument

XMLTag tag = appendTag(xdoc XMLDocument, "toto" string)

delete_XMLDocument xdoc

...and no error !

It's why I'm wondering what the "incorrect use of identifier (appendTag)" error, means exactly ?

Obviously something in my code (the one in the local dxl context)  interferes ....

I firstly though it was because I have in my code (local context) some other appendTag perms (with different signature of course), but I faced the same kind of problem with an other function name that have only one signature...

any help to find approach to investigate would be appreciated.

Kind regards.

...but I faced the same kind of problem with an other function name that have only one signature...

Actually not : I faced this problem always with function names that have multiple signatures.

 

 

Re: pb with multi signature function in startup ?
jaracic - Fri Oct 14 08:05:44 EDT 2016

jaracic - Wed Oct 12 08:55:07 EDT 2016

Hi, 

First of all Thank you for your help.

- Why would you call XML functions from a layout DXL? Layout DXL is only for displaying data, you should never do complicated evaluations from a layout DXL!

Actually I don't need an XML library in DXL layout. Typically in a DXL layout I could need in startup some global variable and high level utilities functions (simple calculations, navigations, formatting...etc.)

 

I just tested you previous response to avoid the "incorrect use of identifier" error, by explicitly indicating the parameter type.

below an extract of my DXL code:

rootStructTag = (XMLTag appendTag(parentTag XMLTag, SERIALIZE_STRUCT string))

And I still have the error :

incorrect use of identifier (appendTag)

It's why I made an other test, by executing the following code (XMLDocument.inc is loaded in startup) :

XMLDocument xdoc = create_XMLDocument

XMLTag tag = appendTag(xdoc XMLDocument, "toto" string)

delete_XMLDocument xdoc

...and no error !

It's why I'm wondering what the "incorrect use of identifier (appendTag)" error, means exactly ?

Obviously something in my code (the one in the local dxl context)  interferes ....

I firstly though it was because I have in my code (local context) some other appendTag perms (with different signature of course), but I faced the same kind of problem with an other function name that have only one signature...

any help to find approach to investigate would be appreciated.

Kind regards.

To better understand what happened I made this test (with your XMLDocument.inc in startup) :

XMLTag appendTag(XMLDocument xdoc, string s, string s2) {
        //blabla
        return (XMLTag null)    
}
XMLDocument xdoc = create_XMLDocument
XMLTag tag = appendTag(xdoc XMLDocument, "toto" string)
delete_XMLDocument xdoc

And I have the "incorrect use of identifier" error.

It means (it seems) that the good practice is to never create in local context a function with the same name as one in the top level context. Actually you(Mathias),  recommended to rename all functions in top level, I assume it is to avoid this kind of problem. Could you confirm that ? Thanks.