Web development with Lua

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Norbert Kiesel
On Tue, 2011-10-18 at 09:13 +0800, Victor Young wrote:
> For more infomation about bamboo,
> visit http://daogangtang.iteye.com/category/159985.

Is there also an English version of that by any chance?

</nk>





Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Victor Young
We will provide English version manual when we publish Bamboo 1.0-rc0.

2011/10/18 Norbert Kiesel <[hidden email]>
On Tue, 2011-10-18 at 09:13 +0800, Victor Young wrote:
> For more infomation about bamboo,
> visit http://daogangtang.iteye.com/category/159985.

Is there also an English version of that by any chance?

</nk>






Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Norbert Kiesel
On Tue, 2011-10-18 at 10:41 +0800, Victor Young wrote:
> We will provide English version manual when we publish Bamboo 1.0-rc0.

Cool.

Just for fun I cloned the repository and started hacking it a bit (right
now just fixing obvious bugs like missing () around print parameters and
some typos).  However, either I'm not getting it or this is still in
some parts very incomplete/untested code (e.g. using '+' instead of '..'
on strings, accessing keys of undefined tables).  Should I just wait and
see (and if so: any idea how long)?

</nk>



Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Tang Daogang


On Tue, Oct 18, 2011 at 11:04 AM, Norbert Kiesel <[hidden email]> wrote:
On Tue, 2011-10-18 at 10:41 +0800, Victor Young wrote:
> We will provide English version manual when we publish Bamboo 1.0-rc0.

Cool.

Just for fun I cloned the repository and started hacking it a bit (right
now just fixing obvious bugs like missing () around print parameters and
some typos).  However, either I'm not getting it or this is still in
some parts very incomplete/untested code (e.g. using '+' instead of '..'

;) I am sorry, Bamboo relies on lglib (https://github.com/daogangtang/lglib), in which I override the __add method with ..

 
on strings, accessing keys of undefined tables).  Should I just wait and
see (and if so: any idea how long)?

some days later please, should be in October or in early November. Then we will provide a official website ;)

Thank you.

</nk>






--
Nothing is impossible.

Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Javier Guerra Giraldez
On Mon, Oct 17, 2011 at 10:53 PM, Tang Daogang <[hidden email]> wrote:
> I override the __add method with ..

what a pity

for me, that's enough to say "thanks, but no thanks".

i have nothing against using + for strings, nor i think that '..' is
nicer than anything; but when i see the basic language modified just
because of carry-over familiarity with other systems, it sends a BIG
message of non-familiarity.

i've made that mistake more than once; and i've always regretted it.
now i see it as a redflag about my own newbieness on whatever new i'm
trying to bend into the old.

--
Javier

Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Norbert Kiesel
On Tue, 2011-10-18 at 09:19 -0500, Javier Guerra Giraldez wrote:

> On Mon, Oct 17, 2011 at 10:53 PM, Tang Daogang <[hidden email]> wrote:
> > I override the __add method with ..
>
> what a pity
>
> for me, that's enough to say "thanks, but no thanks".
>
> i have nothing against using + for strings, nor i think that '..' is
> nicer than anything; but when i see the basic language modified just
> because of carry-over familiarity with other systems, it sends a BIG
> message of non-familiarity.
>
> i've made that mistake more than once; and i've always regretted it.
> now i see it as a redflag about my own newbieness on whatever new i'm
> trying to bend into the old.
>

I agree with that. One part that makes Lua attractive is that it's easy
to read and understand code.  Changing syntax (especially just syntactic
sugar like replacing .. with +) is just not something I want to cope
with.  I saw other "strange" things in the code (e.g. ; as separator in
table initializations) which I now assume are also there deliberately.
Too bad...

Good luck with your project!

</nk>



Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Norbert Kiesel
On Tue, 2011-10-18 at 10:58 -0700, Norbert Kiesel wrote:
>  I saw other "strange" things in the code (e.g. ; as separator in
> table initializations) which I now assume are also there deliberately.
> Too bad...

Hmm, sorry for that.  Just saw that this actually is valid Lua.  Good
day - I learned something new (for me) about Lua...

</nk>



Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Sam Roberts
In reply to this post by Norbert Kiesel
On Tue, Oct 18, 2011 at 10:58 AM, Norbert Kiesel
<[hidden email]> wrote:

> On Tue, 2011-10-18 at 09:19 -0500, Javier Guerra Giraldez wrote:
>> On Mon, Oct 17, 2011 at 10:53 PM, Tang Daogang <[hidden email]> wrote:
>> > I override the __add method with ..
>>
>> what a pity
>>
>> for me, that's enough to say "thanks, but no thanks".
>>
>> i have nothing against using + for strings, nor i think that '..' is
>> nicer than anything; but when i see the basic language modified just
>> because of carry-over familiarity with other systems, it sends a BIG
>> message of non-familiarity.

bamboo isn't a reusable library to be placed into other apps, its an
environment for making web apps.

Doing this is in reusable code would be bad taste, but doing it in a
specific application is taking advantage of lua's flexible nature,
IMO.

> I saw other "strange" things in the code (e.g. ; as separator in
> table initializations) which I now assume are also there deliberately.

That is standard lua, see definition of fieldsep in
http://www.lua.org/manual/5.1/manual.html#2.5.7

Cheers,
Sam

Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Philipp Janda
In reply to this post by Tang Daogang
On 18.10.2011 05:53, Tang Daogang wrote:
> On Tue, Oct 18, 2011 at 11:04 AM, Norbert Kiesel<[hidden email]>wrote:
>
> ;) I am sorry, Bamboo relies on lglib (https://github.com/daogangtang/lglib),
> in which I override the __add method with ..
>

Not a good idea if your strings look like numbers:

$ cat > adds.lua
local mt = getmetatable( "" )
mt.__add = function( a, b )
   return a .. b
end
print( "1" + "2" )
^D

$ lua adds.lua
3

Lua tries to convert arguments of '+' to numbers and apply numeric
addition *before* metamethods are involved.

Philipp


Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Tang Daogang


On Wed, Oct 19, 2011 at 8:33 AM, Philipp Janda <[hidden email]> wrote:
On 18.10.2011 05:53, Tang Daogang wrote:
On Tue, Oct 18, 2011 at 11:04 AM, Norbert Kiesel<[hidden email]>wrote:

;) I am sorry, Bamboo relies on lglib (https://github.com/daogangtang/lglib),
in which I override the __add method with ..


Not a good idea if your strings look like numbers:

$ cat > adds.lua
local mt = getmetatable( "" )
mt.__add = function( a, b )
 return a .. b
end
print( "1" + "2" )
^D

$ lua adds.lua
3

Lua tries to convert arguments of '+' to numbers and apply numeric addition *before* metamethods are involved.

That is true. I think this is lua's flaw, thanks for your mention, let me think how to treat this case.
 
Philipp





--
Nothing is impossible.

Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Tang Daogang
In reply to this post by Norbert Kiesel
You can use .. in the top level project based on bamboo, like what you imagined. We will collect your advices, and make a decision whether to remove '+' overriding in bamboo.

Any more suggestions? 

On Wed, Oct 19, 2011 at 1:58 AM, Norbert Kiesel <[hidden email]> wrote:
On Tue, 2011-10-18 at 09:19 -0500, Javier Guerra Giraldez wrote:
> On Mon, Oct 17, 2011 at 10:53 PM, Tang Daogang <[hidden email]> wrote:
> > I override the __add method with ..
>
> what a pity
>
> for me, that's enough to say "thanks, but no thanks".
>
> i have nothing against using + for strings, nor i think that '..' is
> nicer than anything; but when i see the basic language modified just
> because of carry-over familiarity with other systems, it sends a BIG
> message of non-familiarity.
>
> i've made that mistake more than once; and i've always regretted it.
> now i see it as a redflag about my own newbieness on whatever new i'm
> trying to bend into the old.
>

I agree with that. One part that makes Lua attractive is that it's easy
to read and understand code.  Changing syntax (especially just syntactic
sugar like replacing .. with +) is just not something I want to cope
with.  I saw other "strange" things in the code (e.g. ; as separator in
table initializations) which I now assume are also there deliberately.
Too bad...

Good luck with your project!

</nk>






--
Nothing is impossible.

Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Rena
In reply to this post by Tang Daogang
On Tue, Oct 18, 2011 at 19:48, Tang Daogang <[hidden email]> wrote:

>
>
> On Wed, Oct 19, 2011 at 8:33 AM, Philipp Janda <[hidden email]> wrote:
>>
>> On 18.10.2011 05:53, Tang Daogang wrote:
>>>
>>> On Tue, Oct 18, 2011 at 11:04 AM, Norbert
>>> Kiesel<[hidden email]>wrote:
>>>
>>> ;) I am sorry, Bamboo relies on lglib
>>> (https://github.com/daogangtang/lglib),
>>> in which I override the __add method with ..
>>>
>>
>> Not a good idea if your strings look like numbers:
>>
>> $ cat > adds.lua
>> local mt = getmetatable( "" )
>> mt.__add = function( a, b )
>>  return a .. b
>> end
>> print( "1" + "2" )
>> ^D
>>
>> $ lua adds.lua
>> 3
>>
>> Lua tries to convert arguments of '+' to numbers and apply numeric
>> addition *before* metamethods are involved.
>>
> That is true. I think this is lua's flaw, thanks for your mention, let me
> think how to treat this case.
>
>>
>> Philipp
>>
>>
>
>
>
> --
> Nothing is impossible.
>
>

This is by design. Metamethods are fallbacks, not overrides.

--
Sent from my toaster.

Reply | Threaded
Open this post in threaded view
|

Re: Web development with Lua

Matthew Wild
In reply to this post by Norbert Kiesel
On 18 October 2011 14:36, Norbert Kiesel <[hidden email]> wrote:
> On Tue, 2011-10-18 at 10:58 -0700, Norbert Kiesel wrote:
>>  I saw other "strange" things in the code (e.g. ; as separator in
>> table initializations) which I now assume are also there deliberately.
>> Too bad...
>
> Hmm, sorry for that.  Just saw that this actually is valid Lua.  Good
> day - I learned something new (for me) about Lua...
>

Yes, I love this feature. Believe it or not it's one of my major
annoyances with Javascript that it only supports ',' and doesn't
ignore a trailing separator. I write tables in one of two ways - if on
a single line:

   { "one", "two", "three" }

For a longer list spanning multiple lines, or where I'm likely to
add/remove entries:

   {
       "one";
       "two";
       "three";
   }

Regards,
Matthew

12