-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Am 01.05.2010 09:28, Perry Hargrave wrote:
> 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' ?
Sorry, sure I do.
>> 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?
I don't really have a preference for one or the other. add() could even create
it's own tags, it would even be less code (I think...)
Uli
- --
- - Buck, when, exactly, did you lose your mind?
- - Three months ago. I woke up one morning married to a pineapple.
An ugly pineapple... But I loved her!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iQEcBAEBCAAGBQJL291XAAoJECLkKOvLj8sGizgIALjkL1ujGkRZz0xPUAanSAP1
Y3Z0WCJXpTgjm22c8GC/m7AK7psrc+2HrRDE095ynyPhk8NU5h7QfgPr2G52oQwY
c/zoCazlLK71M2P/4vDOIuaQsBSGZcl1u9TFtPuVpjShh93VaxELePPacUFyR8bw
2RUGdwnqXvHzFuU9vsfjdxwXr7oYh7dgjFyReU9T6UEf1zFz7JPlOgMbcoXK2xab
GB0CDC7xqiVC1k1F6Sp8rzK83qq1AiHsg9GABOZr4VSpqSc76yRkuCeTh7Lqybq/
XOqPlNTP02oLmPePine4vji/H2+JD2lvf7LaUSiciV0sTUoKIdldDJ0pU1gjd6Y=
=uPu+
-----END PGP SIGNATURE-----
--
To unsubscribe, send mail to [email protected].