Andre Arpin <ar...@kingston.net> wrote: (31/12/2010 00:11) > >Lostgallifreyan <z.c...@...> writes: > >> >> Small syntactic question... >> Andre's code in another thread used a dot, the results are neater than the >colon I learned to use.... >> >> ST:SetLabel(SC:GetValue() >> ST.Label=SC.Value >> >> I imagine this is an old issue so I'll keep this short: >> Is one of these methods to be deprecated (made obsolete), and if so, which? >> >> Ok, one more question: >> Is there a case where the two methods are NOT equivalent, and if so, what? > >The . is valid but a trick within wxlua. >Get..., Set... are supported. >
I should have known there was no simple answer to a deceptively simple question. :) Such is code... Is the dot notation also valid in Lua too? I suspect it is, but I need to know if it might likely stay that way. I like your way of writing it, so I'll try it to see how far I can take it without breaking stuff. >Set/GetValue become var.Value = or Foo = var.value >als note that Is is magic so >ww = wx.wxTopLevelWindow ... >then ww.IsActive works >Ok and Eof are also magic, sor var.Ok is useful > I recall that Lua's flexibility with naming things is extreme, I saw an example where Henry=print and so forth, so you could Henry("stuff") to the screen and the madness didn't end there either. >:) I take it this flexibility is partly what allows these alternative notations too? >Now var.Value is resolved in 2 steps (only the first time). > >resolution... >The index fail within the meta (either index/newindex) > >Now the argument must be single for the following to happen. >The index is added to the object, the code is rerun and now works. >In all subsequent call the index allready exist and this all works. >There is a small cost time and space. > >This is syntactic sugar like >function Foo(arg) etc in lua >is >Foo = Function(arg) etc > >Most language and system supports these type of things. >I find it more readable and I like it, other may not. > >Its a free world (sometime). > >Andre > >PS: I have rewritten the Lua editor to suggest all these variances by using >the dynamic binding support. So to me it is easy to use otherwise you have to >remember all the rules. > That's my problem, remembering rules is hard without understanding, and this goes deeper than I know how to go. Even 'syntactic sugar', which I have often seen mentioned, confuses me, but I take it to mean a way of easing the readability of code that associates values, functions, with each other. If so, I'm all for it because I chose Lua because I can read it, think it, as I do with spoken language, and this is impossible with C, at least for me... The practical question is: which constructs in a language as alive and mutable as Lua (wxLua, wxWidgets) will remain archetypal? Some basics need to be consistent in the long term, or we will be forever rewriting our code just to catch up with new Lua or wxLua releases. This, more than anything, drives me to ask questions instead of being able to find out stuff for myself (which I do at least 95% of the time anyway). The more of these method remain in use the better; freedom does matter, I agree. ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users