Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: SSH on Tue 25/10/2005 07:55:06

Title: SUGGESTION: Export at declaration time
Post by: SSH on Tue 25/10/2005 07:55:06
There is redundancy and a bit of hassle in the current system of having the declaration and export of varaibles done separately:


int my_long_variable_name_that_i_might_type_wrong;
export my_long_variable_name_that_i_might_type_wrong;


wouldn't it be possible to add a new mechanism where you can just do:


exporting int my_long_variable_name_that_i_might_type_wrong;


or some other syntax, I'm not fussy  ;)
Title: Re: SUGGESTION: Export at declaration time
Post by: Gilbert on Tue 25/10/2005 08:30:34
Hehe, or even more lazy:

global int blah;

which saves you from putting the import lines in the header (but then you cannot be sure if some variables are global just by looking at the header).

But of course, keep the old "export" and "import" functionalities unchanged, for compatibilities, and that we sometimes need only the variables accessible in one or two rooms, not all.
Title: Re: SUGGESTION: Export at declaration time
Post by: SSH on Tue 25/10/2005 10:13:40
Quote from: Gilbot V7000a on Tue 25/10/2005 08:30:34
global int blah;

which saves you from putting the import lines in the header (but then you cannot be sure if some variables are global just by looking at the header).

But of course, keep the old "export" and "import" functionalities unchanged, for compatibilities, and that we sometimes need only the variables accessible in one or two rooms, not all.

Well, you would change it to ONLY have the import in the header, delteing the export requirement at all rather than the other way around, I think. And yes, this would be in addition to any existing functionality for backward compatibility
Title: Re: SUGGESTION: Export at declaration time
Post by: RickJ on Tue 25/10/2005 21:16:25
I like the idea of being able to put the export directive on the same line as the declaration.  But is a new directive "exporting" really necessary?  Why not just allow the current one, "export" , to be used in this way in addition to current way?


export int my_long_variable_name_that_i_might_type_wrong;


I don't much mind putting the corresponding import statement in the script header as it gives me control over what I am doing.  Not having to explicitly export variables , as SSH suggests is also acceptable to me.
Title: Re: SUGGESTION: Export at declaration time
Post by: Pumaman on Wed 26/10/2005 18:31:59
Yes, something like that would be useful, I agree.
Title: Re: SUGGESTION: Export at declaration time
Post by: strazer on Thu 27/10/2005 00:13:16
Tracker'd: http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=544

I like RickJ's suggestion about reusing the export keyword.
Title: Re: SUGGESTION: Export at declaration time
Post by: SSH on Thu 27/10/2005 11:57:47
Quote from: SSH on Tue 25/10/2005 07:55:06
or some other syntax, I'm not fussy  ;)

Whatever: I was just trying to make the writing of the parsign code for it easier mfor CJ to do, thus more liekly to get implemented ;)