You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, June 25th 2011, 10:55am

Special syntax instead of "get(variable)"

Hi Klaus,

I see a lot of people (including me) making the mistake that I pass the variable name to an action instead of the content of the variable. That's the difference between "action(variable)" and "action(get(variable))" :-)

I know "get" has been introduced after the first release but nevertheless I still don't get used to that syntax because its so different compared to other programming languages (I am software developer). So, I came accross the idea whether you could introduce a special syntax for "content of a variable". My suggestion is to prefix a variable name with "%" or a "$".
The "%" would go in line with the parameters of a action but would mean variables are not allowed to start with numbers. If the "%" isn't a good choice I vote for "$".

I would love to write code like this: "action($variable)" instead of "action(get(variable))".

What do you think?

Michael

2

Saturday, June 25th 2011, 11:30am

Hi,

thanks for your suggestion, I will think about it - and yes, using $ would be possible,

best regards,
Klaus

3

Wednesday, June 29th 2011, 8:12pm

Just want to support this suggestion. I think it's a very good idea. If I'm not mistaken, the "%" syntax is even already possible in certain cases ( like "plugin[%var]")
PanoTag: Facebook tagging for krpano

KRPano development and more: http://www.digisfera.pt/en/development

4

Wednesday, February 29th 2012, 12:42pm

good suggestion

i would like to second gomi42's suggestion!

i think it would also be nice to use this mechanism to unify the mixed use of variables by now where they're handled with and without the get() statement.

as i'm programming a lot in php i think the consistent use of $
when dealing with variables, could do this job.
----------------------------------
thomas bredenfeld

http://panoramabuch.com
http://bredenfeld.com