[tag][filter-tag]<StandardFilter> or [tag]<StandardFilter>

Discussion of Lua and LuaWML support, development, and ideas.

Moderators: Forum Moderators, Developers

Post Reply
Anonymissimus
Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

[tag][filter-tag]<StandardFilter> or [tag]<StandardFilter>

Post by Anonymissimus » March 1st, 2011, 11:09 pm

The point: Should wml action tags (implemented in lua or C++) which take a standard filter have an additional tag introducing that filter ? Such as [harm_unit][filter]<SUF> although it is not really neccessary there.

pros:
-Better overview, separation, especially if additional [tag]-specific keys get added later.
-Keys (subtags...) can easily be added to the standard filter as opposed to the nightmare of checking all [tag]<StandardFilter> - type of tags for collisions with the new key; it might already have a meaning in one of those tags.

cons:
-Annoying need to write extra [filter-tag] if calling from wml or {"filter-tag", {}} if from lua every time.
Elvish_Hunter wrote:Perhaps we can follow this rule:
- if the tag has only one or two extra keys, and these aren't part of SUF, no [filter] is needed (example: [slow], that has no extra keys)
- if the tag has more extra keys, [filter] is needed to keep it tidy (example: [harm_unit])
- if the tag has a key that is already part of SUF, [filter] is needed to avoid problems.
Just a proposal that can be improved and corrected. :wink:
(I hope you don't mind @E_H...)
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

User avatar
Alarantalara
macOS Packager
Posts: 782
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Alarantalara » March 2nd, 2011, 12:06 am

I'd like it if filters only appeared without extra tags if there were no other attributes for the tag. Makes it easier to remember when to write it out.

Call it an argument for simplicity.

User avatar
Elvish_Hunter
Developer
Posts: 1360
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Elvish_Hunter » March 2nd, 2011, 9:31 am

Anonymissimus wrote:(I hope you don't mind @E_H...)
No, I don't mind.
Spoiler:
Well, you already quoted my opinion, so no need to repeat... :mrgreen:
Current maintainer of The Sojournings of Grog, Children of Dragons, A Rough Life and Wesnoth Lua Pack
Co-author of The White Troll
On Wesbreak until the 21th of December

Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Max » March 2nd, 2011, 10:32 am

i guess there's no doubt that using extra tags would be a much cleaner implementation.

don't you think the transition would be quite complicated? not too hard on the source side but there's the wiki as well. the hardest part might be wmllint...

Anonymissimus
Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Anonymissimus » March 2nd, 2011, 3:19 pm

Alarantalara wrote:I'd like it if filters only appeared without extra tags if there were no other attributes for the tag. Makes it easier to remember when to write it out.
It can always happen that we suddenly want to add an additional key to a [tag]<StandardFilter> - type of tag since someone has an idea for a cool and easy to implement feature which none thought of before...

If we would generally use only one variant there would be less confusion about whether or not the extra filter tags are needed in a particular case. This would need to be the extra-tag one then.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

User avatar
Alarantalara
macOS Packager
Posts: 782
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Alarantalara » March 2nd, 2011, 5:05 pm

That's true. I guess it isn't desirable to break compatibility whenever a first attribute is added.

User avatar
Sapient
Developer
Posts: 4429
Joined: November 26th, 2005, 7:41 am
Contact:

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Sapient » March 2nd, 2011, 5:32 pm

If I remember correctly, I proposed a similar coding standard a while back when I was fixing a bug with [recall] x,y= attribute. But as I remember, Sirp was against using [filter] in all cases because he considered forms like [unpetrify] id=Konrad to be both simple and easy to use/type.

Although it was originally [unstone] description=Konrad, so maybe that's a bad example. ^_^
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

Anonymissimus
Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Anonymissimus » March 3rd, 2011, 3:47 am

Sapient wrote:But as I remember, Sirp was against using [filter] in all cases because he considered forms like [unpetrify] id=Konrad to be both simple and easy to use/type.

Although it was originally [unstone] description=Konrad, so maybe that's a bad example. ^_^
Ironically, the syntax for that tag was in reality [unpetrify][filter]<SUF>. All occurances of the tag in mainline were using it incorrectly (without [filter]) but it did still work in all those cases due to the usages simply wanting to unpetrify all units (which was the default for no [filter] given.) If they had tried to keep some unit petrified while unpetrifying another one it wouldn't have worked... But I did change the syntax to [unpetrify]<SUF> in a recent revision so it's actually a suitable example ;).
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

User avatar
Sapient
Developer
Posts: 4429
Joined: November 26th, 2005, 7:41 am
Contact:

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Sapient » March 3rd, 2011, 11:07 am

Ha, I picked the worst example possible. I even wrote [stone] at first before remembering that tag was a myth.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
zookeeper
WML Wizard
Posts: 9694
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by zookeeper » March 3rd, 2011, 1:27 pm

The transition could be a bit of a hassle, but I think it'd be worth it, so no objections from me.

However, it's worth noting that we'd still have a few tags which would accept SUF + extra keys, although they aren't ActionWML tags: for example, [have_unit] has count=, [filter_adjacent] has is_enemy= and adjacent=, etc.

Anonymissimus
Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Anonymissimus » March 3rd, 2011, 3:31 pm

Wait. I did not propose anything, I didn't even write my opinion, I just wrote down facts and started a discussion here. I rather thought of future tags.
So if the proposal is to change all [tag]<StandardFilter> tags to [tag][filter-tag]<StandardFilter> ones (including non-action tags) fist thing would be to ask esr or ai whether this is feasible regarding wmllint.
Also note that there are supposedly situations which cannot be detected by wmllint due to the lack of macro expansion.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by AI » March 4th, 2011, 12:06 am

Should be relatively simple. What's needed is a list of tags to convert, with for each tag, the list of keys and tags that should not be moved into the new [filter].
The replacement code itself can be pretty short, though there are probably a couple of annoying corner-cases. Especially macros.

The big question remains: do we actually want this?

User avatar
shadowm
Site Administrator
Posts: 6364
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by shadowm » March 4th, 2011, 12:36 am

Sapient wrote:Ha, I picked the worst example possible. I even wrote [stone] at first before remembering that tag was a myth.
Anonymissimus fixed it for you. ;)
(Sort of. In preparation for 1.7.0 ESR pushed a change to move away from “stone” to “petrify” due to the former’s unfortunate implications.)
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Elsewhere: shadowmBlogFollow me on Twitter

User avatar
Elvish_Hunter
Developer
Posts: 1360
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Elvish_Hunter » March 4th, 2011, 10:24 am

AI wrote:The big question remains: do we actually want this?
I was thinking, what about making a poll? Perhaps like this:
Do you think that WML tags that require a SUF should use [filter] sub-tags?
  • Yes, always
  • Yes, unless the tag has no or few extra keys
  • No, never
  • Other (explanation below)
Current maintainer of The Sojournings of Grog, Children of Dragons, A Rough Life and Wesnoth Lua Pack
Co-author of The White Troll
On Wesbreak until the 21th of December

Anonymissimus
Developer
Posts: 2458
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: [tag][filter-tag]<StandardFilter> or [tag]<StandardFilte

Post by Anonymissimus » March 4th, 2011, 6:57 pm

Elvish_Hunter wrote: Do you think that WML tags that require a SUF should use [filter] sub-tags?
Not only SUFs. SLFs too (and possibly other filters).

I was thinking about who would do this ton of work introducing lots of bugs.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign

Post Reply