lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


[warning: meta post, no irony]

Hi Stefan (and PetiteAbeille and others),

I really enjoy all the fights you are starting around here: it gives me a lot of brain food, mainly on two topics:

I. The poorness of email communication. This is a fact we all know and tend to forget, but emails on a mailing list is probably the poorest means of communication ever designed. We miss all the information transported by body language (attitude, gestures, eye sight, hands), voice (tone, timbre, loudness, etc) and timing (is it a fast response?, a well thought argument?, etc). But this is not all, the inherent segmentation and slowness of the medium tends to fragment the context into something that quickly becomes unintelligible. Things that can happen in normal conversations if nobody really cares (loosing the thread) happens faster on a mailing list unless careful people keep discussions on topic.

II. The difficulty to gain a place in a community; moreover in a long lasting, fragmented and distributed community with people from many different backgrounds, cultures and expectations. In this context, it is not possible to "cling" to a friend (already a member of said community) for a while in order to be accepted: you have to struggle on your own. And in a technically oriented list like this one, this means that you are judged on merit (constructive replies, technical knowledge, humour, etc) and some things interest people more then other things so the technical merit is really very subjective and slippery. In this regard forums like OSQA (stackoverflow, etc) are better suited at evaluating merit, but I am not sure they can are better tools at community building. Meritocracy is not exactly the coolest place around.

Now, I would like to say that you have pretty well accomplished joining the circle of people on this list that are part of my representation of the community:

- I know your name
- I know some of your projects
- I respect your powerful energy (and language)

In two words, despite all the noise of the big internet, you managed to raise my attention.

I really hope you keep up with this fantastic energy of yours and use the fights to strengthen your muscles and not get beaten !

Cheers and happy dancing !

Gaspard no sorry for feeding the trolls, elves and all the weird creatures of the otherworld.


On Sat, Nov 26, 2011 at 11:45 PM, Stefan Reich <stefan.reich.maker.of.eye@googlemail.com> wrote:
Hi Bernd!

Wow, finally!!! A constructive response that actually has THOUGHT in it. I almost thought this list was unable of that.

IMO you are expressing your criticism a little harshly ("severe flaws" that are not really that severe in the end :)), but at least there is technical thought in it and I sincerely applaud that.

I will look into the technical details of your answer very soon and give you an appropriate reply (retort? whatever :)).

Cheers,
Stefan


On Sat, Nov 26, 2011 at 7:58 PM, Bernd Eggink <monoped@sudrala.de> wrote:
On 21.11.2011 15:15, Leo Razoumov wrote:
On Sun, Nov 20, 2011 at 07:27, Stefan Reich
<stefan.reich.maker.of.eye@googlemail.com>  wrote:
Hi guys!

I just created a neat little object system for Lua (5.1) that does pretty
much exactly what I want.

You use it like this:

newThing = object(function() -- could add arguments here too
  var1 = 1
  local var2 = 'test'

  function method1()
    var1 = var1+1
  end
[[snip]]

An elegant idea, indeed! And  'self' reference is avoided.

It may look elegant, but it has some severe flaws (IMHO).

1. If the function's environment is made identical to the global environment, any global variable X can be accessed as obj.X. This is at least confusing and contradicts the OO paradigma. Example:

--------------------------------------------------------
y = 222

function Class(c)
   x = c
end

function ctor(definition)
   return function(...)
       local env = setmetatable({}, {__index = _G })
       setfenv(definition, env)(...)
       return env
   end
end

obj = ctor(Class)(1)
print(obj.y)   --> 222
--------------------------------------------------------

2. In the example above, obj.x can be read and changed from outside. To prevent this, one would normally make the variable local. This leads to even more weirdness:

--------------------------------------------------------
x = 111

function Class(c)
   local x = c
   function pr() print("obj.x", x) end
end

function ctor(definition)
   return function(...)
       local env = setmetatable({}, {__index = _G })
       setfenv(definition, env)(...)
       return env
   end
end

obj = ctor(Class)(1)

print(obj.x, x)   --> 111 111
obj.pr()          --> 1

obj.x=112
print(obj.x, x)   --> 112 111
obj.pr()          --> 1
--------------------------------------------------------

I admit that I don't quite understand why the last example behaves as it does. I would be glad if somebody could explain what happens here; I'm experienced in Java, but still a beginner in Lua.

Regards,
Bernd

--
http://sudrala.de





--

                                                               Gaspard