Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - Referenced identifier not available in context
Author Message
  Post subject:  Re: Referenced identifier not available in context  Reply with quote
malex wrote:
if you only need to set an attribute to a single current ring -
did you try to access it via basering in accessReferencedRing directly (without references) instead?

hope that helps,
O.

Thanks,

bu my minimal example was insufficient.
In my code I expect that 'attrib' works correctly also for non-active rings.

But I do not want to mixture up the two different issues.
This thread is about references across libraries and in my opinion it is a must -
it is possible to give a myriad of minimal examples, which leads to serious restrictions if references across libraries are not supported.

How should a user manipulate data structures which contains multiple references to the same object?
In case there is an existimg library routine for manipulation of that data, is the user forced to replace all (multiple) references
with hard copies? or has he to copy/ all operations into his own library to be able to use references as parameters ??

What are the arguments not to support or not to allow references across libraries?


Jack

Updated minimal failing example:

system("reference");

proc setAttrib( rng, attrubuteName, attributeVal)
{

attrib( rng, attrubuteName, attributeVal);

}

proc setAttribOfRef( pRngRef, attrubuteName, attributeVal)
{

attrib( pRngRef ,attrubuteName, attributeVal);

}

proc minimalExample()
{

string attributeName = "name";
string attributeVal = "it works!";
ring parentRing = integer,(x,y,z),dp;
ring childRing = integer,(x,y),dp;

setring childRing;

setAttrib( parentRing, attributeName, attributeVal );

if ( attrib( parentRing, attributeName )<> attributeVal )
{

print("setting attrubute by passing ordinary copy failed");

}
else {

print("setting attrubute by passing ordinary copy succeeded");

}

reference rngRef = parentRing;
setAttribOfRef( rngRef,attributeName,attributeVal);


if ( attrib( parentRing, attributeName )<> attributeVal )
{

print("setting attrubute by passing reference failed");

}
else {

print("setting attrubute by passing reference succeeded !");

}

}

minimalExample();
Post Posted: Tue Sep 24, 2013 3:16 pm
  Post subject:  Re: Referenced identifier not available in context  Reply with quote
if you only need to set an attribute to a single current ring -
did you try to access it via basering in accessReferencedRing directly (without references) instead?

hope that helps,
O.
Post Posted: Tue Sep 24, 2013 11:28 am
  Post subject:  Re: Referenced identifier not available in context  Reply with quote
hannes wrote:
PS: using reference for rings is a very bad idea: there are special rules
for the name resolution of rings which do not apply to reference.
And: assignment of rings do not produce a copy.



Unfortunately I have to pass rings by reference, since otherwise 'attrib' does not work as expected,
see the bug report in track, ticket 502 (cannot post url here)

Is the issue description understandable, or should I try to improve it?


Thanks,


Jack
Post Posted: Thu Sep 19, 2013 12:03 pm
  Post subject:  Re: Referenced identifier not available in context  Reply with quote
rng is a local variable of the routine callExternLib.
Therefore it is not available in another routine.
Hide this fact via the use of reference does not help.
(Remember: reference is a reference to the name
of another variable.)

PS: using reference for rings is a very bad idea: there are special rules
for the name resolution of rings which do not apply to reference.
And: assignment of rings do not produce a copy.
Post Posted: Wed Sep 18, 2013 10:23 am
  Post subject:  Re: Referenced identifier not available in context  Reply with quote
Nobody knows an answer?
Post Posted: Fri Sep 13, 2013 6:36 pm
  Post subject:  Referenced identifier not available in context  Reply with quote
Hello,


why the following setup does not work,
and is this a desired behaviour?

Consider .lib files 'main.lib' and 'extern.lib'

Code:
// 'main.lib':
proc callExternLib()
{
   ring rng= 0,x,dp;
   reference ref= rng;
   accessReferencedRing(ref);
}


Code:
// 'extern.lib'
proc accessReferencedRing(ringRef)
{
     def name = attrib( ringRef, "name" );
}


Then the following examle triggers an error:
Code:
LIB "main.lib";
LIB "extern.lib";

callExternLib();
// leads to ? Referenced identifier not available in current context
Post Posted: Wed Jul 03, 2013 12:04 pm


It is currently Mon Dec 11, 2017 1:31 pm
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group