-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: SetWidget syntax change + enhancement #1610
Comments
Hi @felixhayashi as you've noted, the backwards compatibility problem with the proposal is the ambiguity with the existing syntax. A backwards compatible version of the proposal might be:
It's annoyingly inconsistent with other widget usage of the The other option of implementing the widget under a different name is attractive, except that I don't think we've got a good enough name yet - |
Hi @Jermolene thanks for responding on this.
I agree, people will confuse/forget when to use the $ and when not.
Good point, a key widget like $set should be easy to type. The idea of using let is truly appealing as (1) it shows the close relation to set, (2) fast to type (3) is used in other languages to define a constant which is also fine for our case and (4) the letter "l" is far away from "s" on euro-keyboards so it cannot be confused.
I think it is a plus that they sound similar. Set is clearly documented so I think the risk that somebody confuses let with the former set is minimal and does not compete with the advantages of the term mentioned above. If you still do not like "let" what about
-Felix |
Hmm |
Hehe, a second before you commented, I had the same thought and edited my post - so yes, I agree on that ;) |
Should I do a pull request or do you want to handle this? |
Please do go ahead with a pull request - I'll merge after 5.1.8 is out. |
ok |
It thereby reduces code complexity that would arise when setting many variables using "<$set>". ``` \define helloworld() Hello world! <$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>> <<greeting>>! I am <<me>> and I say: <<sentence>> </$vars> ``` How this Widget differs from the set widget: * Variables may be created by using the "key=value" notation that you already know from widgets like action-setfield. * You cannot specify a fallback ("emptyValue") * You cannot use a filter to produce a conditional variable assignement Original discussion that led to the creation of this widget: TiddlyWiki#1610
Hi @Jermolene I now created the corresponding pull request. -Felix |
It thereby reduces code complexity that would arise when setting many variables using "<$set>". ``` \define helloworld() Hello world! <$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>> <<greeting>>! I am <<me>> and I say: <<sentence>> </$vars> ``` How this Widget differs from the set widget: * Variables may be created by using the "key=value" notation that you already know from widgets like action-setfield. * You cannot specify a fallback ("emptyValue") * You cannot use a filter to produce a conditional variable assignement Original discussion that led to the creation of this widget: TiddlyWiki#1610
I also included a widget description for the tiddlywiki.com docs in this pull request. -Felix |
It thereby reduces code complexity that would arise when setting many variables using "<$set>". ``` \define helloworld() Hello world! <$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>> <<greeting>>! I am <<me>> and I say: <<sentence>> </$vars> ``` How this Widget differs from the set widget: * Variables may be created by using the "key=value" notation that you already know from widgets like action-setfield. * You cannot specify a fallback ("emptyValue") * You cannot use a filter to produce a conditional variable assignement Original discussion that led to the creation of this widget: TiddlyWiki#1610
It thereby reduces code complexity that would arise when setting many variables using "<$set>". ``` \define helloworld() Hello world! <$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>> <<greeting>>! I am <<me>> and I say: <<sentence>> </$vars> ``` How this Widget differs from the set widget: * Variables may be created by using the "key=value" notation that you already know from widgets like action-setfield. * You cannot specify a fallback ("emptyValue") * You cannot use a filter to produce a conditional variable assignement Original discussion that led to the creation of this widget: TiddlyWiki#1610
It thereby reduces code complexity that would arise when setting many variables using "<$set>". ``` \define helloworld() Hello world! <$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>> <<greeting>>! I am <<me>> and I say: <<sentence>> </$vars> ``` How this Widget differs from the set widget: * Variables may be created by using the "key=value" notation that you already know from widgets like action-setfield. * You cannot specify a fallback ("emptyValue") * You cannot use a filter to produce a conditional variable assignement Original discussion that led to the creation of this widget: TiddlyWiki#1610
It thereby reduces code complexity that would arise when setting many variables using "<$set>". ``` \define helloworld() Hello world! <$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>> <<greeting>>! I am <<me>> and I say: <<sentence>> </$vars> ``` How this Widget differs from the set widget: * Variables may be created by using the "key=value" notation that you already know from widgets like action-setfield. * You cannot specify a fallback ("emptyValue") * You cannot use a filter to produce a conditional variable assignement Original discussion that led to the creation of this widget: TiddlyWiki#1610
It is very(!!) annoying to set multiple variables as it spams the code.
Would something like the following be possible (e.g. like it already exists for the set field widget or the send message widget)
I know that this new syntax would mean that keys "name" and "value" would be misinterpreted and break backwards compatibility.
Therefore we could either treat "name" and "value" specially or introduce a new set widget to the core called e.g. "<$multi-set" or "<$xset" or something like this.
Thanks
-Felix
The text was updated successfully, but these errors were encountered: