On Sat, May 01, 2010 at 08:58:29AM +0200, Uli Schlachter wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Am 01.05.2010 01:04, perry wrote:
> > +--- Add a tag
> > +-- @param name The tag name, a string
> > +-- @param properties The tags properties, a table
> > +-- @return The created tag
> > +function add(name, properties)
> > +    local newtag = unpack(new({name},
> > +                        properties.screen or 1,
> > +                        properties.layout or nil))
> 
> No major comments here, but I had to look up what untag does.

do you mean 'unpack' ?

> If you don't object it too much (really, just a minor comment), what do you
> think about doing this instead:
> 
> local newtags = new({ name }, ......)
> local newtag = newtags[1]

honestly I think changing the whole order of functiosn would be better,
but I was reluctant to smash new(). imo add() is more general than
new(). that is to say, I could easily see new() becoming something like
this:

function new(names, s, layout)
    local tags = {}
    for _, n in pairs(names) do
        table.insert(add(n, s, {layout = layout}))
    end
    return tags
end

and so then in add() we do the actual tag creation.

function add(name, props)
   local t = capi.tag{name = name}

    -- loop over properties...
    ...

do you like that?



-- 
To unsubscribe, send mail to [email protected].

Reply via email to