Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- Matt Towers
- Date:
- 2011-05-17 @ 18:44
Hi Josh,
It looks like removing the the use of modules is going to necessitate a
number of changes on the Tir side. Is that correct?
I think we'll also need the directory cache_ttl stuff in there to get the
config to load properly in m2.
✈ Matt
On May 17, 2011, at 04:39 , joshua simmons wrote:
> Not sure if anything is using it, but the
examples/python/mongrel2/sql/config.sql file is out of sync with
src/config/config.sql
>
> It also looks like cache_ttl was added, and then removed from mongrel2.
Is this the case, should we get it working again?
>
> https://github.com/jsimmons/mongrel2-lua/tree/1.6 should be right to
work off now though.
>
> On Tue, May 17, 2011 at 8:49 PM, joshua simmons <simmons.44@gmail.com> wrote:
> OK so step one complete.
>
> Legacy code can now use
https://github.com/jsimmons/mongrel2-lua/raw/master/rockspecs/mongrel2-lua-1.4.1.rockspec
to install a suitable version of mongrel2-lua.
>
> Now I will merge in the last of the changes to mongrel2-lua, this will
be thrown into master so one can use the mongrel2-scm-0 so we can make
sure everything works, then release 1.6.0 and give it a versioned rockspec
too.
>
>
> On Tue, May 17, 2011 at 10:35 AM, Matt Towers <matt@ziplinegames.com> wrote:
> No worries. I'm on this full time right now so if there's any testing I
can help with, just let me know.
>
> ✈ Matt
>
>
>
> On May 16, 2011, at 17:21 , joshua simmons wrote:
>
>> Sorry guys, it's been a bit hectic the past few days.
>>
>> I might get a look in tonight, but that's not for another 8 hours or so.
>>
>> As far as making it work goes, Matt's patch should be sweet, I don't
want to apply it to master though in an attempt not to break anybody
trying to use existing versions. I've got a 1.6 branch with the beginnings
of tnetstrings and most of the config fixes. Hopefully I'll be able to
work this into a decent release tonight. I kinda want to get some testing
happening at the same time, but that might end up being put off again.
>>
>> So basically, do what you need to and I'll have a go at picking up the
pieces and joining them all back together tonight.
>>
>> Cheers,
>> Josh.
>>
>> On Tue, May 17, 2011 at 7:15 AM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
>> On Mon, May 16, 2011 at 11:38:33AM -0700, Matt Towers wrote:
>> > Hi Josh,
>> >
>> > Have you perchance had an opportunity to look into making that
patch to Tir? I just did an end-to-end test using my current mongrel2-lua
library and a local copy of Tir tweaked as described below. Everything
seems copacetic.
>>
>> Yeah Josh, I'm looking to work on Tir tonight, so if you can't get
>> m2-lua updated then let me know. I'll do a fork and change the docs to
>> point at my fork.
>>
>> --
>> Zed A. Shaw
>> http://zedshaw.com/
>>
>
>
>
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- Zed A. Shaw
- Date:
- 2011-05-17 @ 18:51
On Tue, May 17, 2011 at 11:44:55AM -0700, Matt Towers wrote:
> Hi Josh,
>
> It looks like removing the the use of modules is going to necessitate a
number of changes on the Tir side. Is that correct?
It shouldn't, but I'm also curious why modules are getting dropped. Is
there something I should know about them other than that Lua people
prefer that incredibly ugly nasty "DIY module" bullshit
syntax?
--
Zed A. Shaw
http://zedshaw.com/
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- Zed A. Shaw
- Date:
- 2011-05-17 @ 19:08
On Tue, May 17, 2011 at 11:51:17AM -0700, Zed A. Shaw wrote:
> On Tue, May 17, 2011 at 11:44:55AM -0700, Matt Towers wrote:
> > Hi Josh,
> >
> > It looks like removing the the use of modules is going to necessitate
a number of changes on the Tir side. Is that correct?
>
> It shouldn't, but I'm also curious why modules are getting dropped. Is
> there something I should know about them other than that Lua people
> prefer that incredibly ugly nasty "DIY module" bullshit
> syntax?
Ok, this syntax Josh, and sorry to be blunt, is completely unreadable:
local MOD, META = {}, {}
META.__index = META
What is this a META of? Can't you use the class name? Why is there so
much boilerplate like .__index and having do to your own accounting just
to make a module. What happens if you have more than one class, you
name them all META? Why not just have the new function generate the
class inside itself instead of al this jiggering of META tables all
over?
This really should be done a more readable way. Why can't you use the
class name instead of META? Then it'd be easy to understand what class
you're actually making. Also, why ditch the module syntax. It
completely breaks all the Tir and Bamboo code and forces people to adopt
the module protocol you're using, which is nasty.
Whatever you do, please don't do this to Tir. Let's come up with a
standard on how this is done before you make any changes. I *really*
don't like this new style module.
--
Zed A. Shaw
http://zedshaw.com/
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- joshua simmons
- Date:
- 2011-05-17 @ 22:31
Basically module is being removed from Lua, the changes required are trivial
'local x = require 'abc' rather than require 'abc' (which is kinda how you
should be doing it anyway)
Using meta was a throw back to my ol garry's mod days, and because it's the
module's metatable. Giving it the class name is much more sane though.
I'll have a look into making it more readable in mongrel2-lua but I don't
really want to take it away entirely.
Ah looks like I've been sitting on the proxymustdie branch which is why I'm
on a completely different page with the config stuff.
On Wed, May 18, 2011 at 5:08 AM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
> On Tue, May 17, 2011 at 11:51:17AM -0700, Zed A. Shaw wrote:
> > On Tue, May 17, 2011 at 11:44:55AM -0700, Matt Towers wrote:
> > > Hi Josh,
> > >
> > > It looks like removing the the use of modules is going to
> necessitate a number of changes on the Tir side. Is that correct?
> >
> > It shouldn't, but I'm also curious why modules are getting dropped. Is
> > there something I should know about them other than that Lua people
> > prefer that incredibly ugly nasty "DIY module" bullshit
> > syntax?
>
> Ok, this syntax Josh, and sorry to be blunt, is completely unreadable:
>
> local MOD, META = {}, {}
> META.__index = META
>
> What is this a META of? Can't you use the class name? Why is there so
> much boilerplate like .__index and having do to your own accounting just
> to make a module. What happens if you have more than one class, you
> name them all META? Why not just have the new function generate the
> class inside itself instead of al this jiggering of META tables all
> over?
>
> This really should be done a more readable way. Why can't you use the
> class name instead of META? Then it'd be easy to understand what class
> you're actually making. Also, why ditch the module syntax. It
> completely breaks all the Tir and Bamboo code and forces people to adopt
> the module protocol you're using, which is nasty.
>
> Whatever you do, please don't do this to Tir. Let's come up with a
> standard on how this is done before you make any changes. I *really*
> don't like this new style module.
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- Zed A. Shaw
- Date:
- 2011-05-17 @ 22:55
On Wed, May 18, 2011 at 08:31:29AM +1000, joshua simmons wrote:
> Basically module is being removed from Lua, the changes required are trivial
> 'local x = require 'abc' rather than require 'abc' (which is kinda how you
> should be doing it anyway)
Yeah it works, but (as I mentioned in IRC) making me do it manually is
annoying.
> Using meta was a throw back to my ol garry's mod days, and because it's the
> module's metatable. Giving it the class name is much more sane though.
>
> I'll have a look into making it more readable in mongrel2-lua but I don't
> really want to take it away entirely.
Cool, yes take a look at how I'm doing it in Tir where I have two modes
of making classes:
1. ClassName = {} or ClassName = { blah = function }. Those work for
typical style classes.
2. A function that can be used to "mint" or generate classes like #1.
When I find a pattern in a bunch of classes, I then wrap them up in a
function that makes the class on the fly and returns it. Then I use
that after to mint a bunch of them.
That is really all you need and it's easy to use.
> Ah looks like I've been sitting on the proxymustdie branch which is why I'm
> on a completely different page with the config stuff.
Sweet, that explains it.
--
Zed A. Shaw
http://zedshaw.com/
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- joshua simmons
- Date:
- 2011-05-17 @ 23:52
Also, the __index stuff is completely unrelated to any changes. That's bog
standard Lua prototype OOP and has been like that since the beginning.
The only change I've made is instead of module implicitly creating a module
table and putting it in the global scope, we create the table inside the
module, and return it from the module block.
The module function worked by creating a table, then setting that table as
the environment for the current block. Especially when used with
package.seeall there are a range of non-trivial issues with this method.
Firstly it puts your module straight into global scope, which has the usual
problems, less obviously, when using package.seeall the said module table
has it's metatable __index set to global _G which means one can break out of
a sandbox. Because modules can have dependencies and they too are loaded
into the global scope, dependencies are hidden from the caller. The
conclusion was that it was causing more issues than it was worth, and
replacing one line of magic code with two lines of simple non-magic code is
a good move.
I will definitely do a tidy up pass on the whole code base though.
On Wed, May 18, 2011 at 8:55 AM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
> On Wed, May 18, 2011 at 08:31:29AM +1000, joshua simmons wrote:
> > Basically module is being removed from Lua, the changes required are
> trivial
> > 'local x = require 'abc' rather than require 'abc' (which is kinda how
> you
> > should be doing it anyway)
>
> Yeah it works, but (as I mentioned in IRC) making me do it manually is
> annoying.
>
> > Using meta was a throw back to my ol garry's mod days, and because it's
> the
> > module's metatable. Giving it the class name is much more sane though.
> >
> > I'll have a look into making it more readable in mongrel2-lua but I don't
> > really want to take it away entirely.
>
> Cool, yes take a look at how I'm doing it in Tir where I have two modes
> of making classes:
>
> 1. ClassName = {} or ClassName = { blah = function }. Those work for
> typical style classes.
> 2. A function that can be used to "mint" or generate classes like #1.
> When I find a pattern in a bunch of classes, I then wrap them up in a
> function that makes the class on the fly and returns it. Then I use
> that after to mint a bunch of them.
>
> That is really all you need and it's easy to use.
>
> > Ah looks like I've been sitting on the proxymustdie branch which is why
> I'm
> > on a completely different page with the config stuff.
>
> Sweet, that explains it.
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- Zed A. Shaw
- Date:
- 2011-05-17 @ 15:24
On Tue, May 17, 2011 at 09:39:14PM +1000, joshua simmons wrote:
> Not sure if anything is using it, but the
> examples/python/mongrel2/sql/config.sql file is out of sync with
> src/config/config.sql
Ok added, but don't use that as the authoratative guide. Whatever
src/config/config.sql says is gospel and the others are wrong.
> It also looks like cache_ttl was added, and then removed from mongrel2. Is
> this the case, should we get it working again?
No, it wasn't removed, it's still in the src/config/config.sql. Don't
look at the python lib for guidance on this, just the
src/config/config.sql.
> https://github.com/jsimmons/mongrel2-lua/tree/1.6 should be right to work
> off now though.
Awesome, thanks.
--
Zed A. Shaw
http://zedshaw.com/
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- Matt Towers
- Date:
- 2011-05-17 @ 15:30
Is Tir all synced up now too?
✈ MCT
On May 17, 2011, at 8:24, "Zed A. Shaw" <zedshaw@zedshaw.com> wrote:
> On Tue, May 17, 2011 at 09:39:14PM +1000, joshua simmons wrote:
>> Not sure if anything is using it, but the
>> examples/python/mongrel2/sql/config.sql file is out of sync with
>> src/config/config.sql
>
> Ok added, but don't use that as the authoratative guide. Whatever
> src/config/config.sql says is gospel and the others are wrong.
>
>> It also looks like cache_ttl was added, and then removed from mongrel2. Is
>> this the case, should we get it working again?
>
> No, it wasn't removed, it's still in the src/config/config.sql. Don't
> look at the python lib for guidance on this, just the
> src/config/config.sql.
>
>> https://github.com/jsimmons/mongrel2-lua/tree/1.6 should be right to work
>> off now though.
>
> Awesome, thanks.
>
> --
> Zed A. Shaw
> http://zedshaw.com/
Re: [mongrel2] Proposed Tweak to Tir and mongrel2-lua
- From:
- Zed A. Shaw
- Date:
- 2011-05-17 @ 17:02
On Tue, May 17, 2011 at 08:30:04AM -0700, Matt Towers wrote:
> Is Tir all synced up now too?
Can you confirm your patch still works with the latest mongrel2-lua,
then I'll apply it.
--
Zed A. Shaw
http://zedshaw.com/