Hi Joe,

At the surface, the widget-oriented language of TiddlyWiki is just another
domain specific language (
https://en.wikipedia.org/wiki/Domain-specific_language) that we have to
learn by doing, little by little. SQL or LaTeX are not of the generic kind
either, but they are quite adapted to their tasks.

Now the fact that Javascript lays underneath allows you to add any feature
that you consider missing. For instance, Evan Balster made a "condition"
plugin as part as his work on Excel formulas (yet another DSL!) which is
less domain specific than the RevealWidget approach:
http://evanbalster.com/tiddlywiki/formulas.html#%24%3A%2Fplugins%2Febalster%2Fcondition

Cheers,
Xavier.

-- Xavier Cazin

On Mon, Mar 19, 2018 at 11:36 AM, Joe Armstrong <joea...@gmail.com> wrote:

> I should explain my question a little more.
>
> What I wanted to in pseudo code was something like this:
>
> If (this_tiddler_has_tag("foo")) {
>     <h1>Hello I'm a foo</h1>
>     <button>Click</button>
> } else {
>     <h1>Hello</h1>
>  }
>
> Now there are 10 quadzilion template languages that can do this.
> For example in django I might write
>
> {% if has_tag("foo") %}
>    <h1>hello I'm a foo</h1>
>    ...
> {% else %}
>    <h1>hello<>h1>
> {% endif %}
>
> Pretty easy for anybody to understand - the django filter language is
> described
> at https://djangobook.com/basic-template-tags-filters/
>
> (I'm not recommending django BTW - it's for the example)
>
> The point is this type of syntax (call it django, php, etc.) is
> vary familiar.
>
> The <$list ..> syntax is as far as I can see ,what in many other languages
> would be called
> a list comprehension. Some language call these iterators.
>
> I'd have expected a syntax link this:
>
>     <? for i in tiddlers_with_tag("foo") && tiddlers_with_tag("bar") ?>
>
>         <h1> ${i).title </h1>
>
>     <? endfor ?>
>
> The TW equivalent has no variable i but seems to have an implicit variable
> <<currentTiddler>> which is somewhat confusing.
>
> As it is the similarity to HTML leads me to believe that the widget is
> something like HTML (which it is not) - rather than a programming
> language construct (which it is)
>
> Strange syntax frightens beginners off - they feel happier
> with familiar syntax.
>
>
> On Monday, 19 March 2018 00:18:09 UTC+1, Jed Carty wrote:
>>
>> Wikitext isn't a Turing completely language, there aren't necessarily
>> equivalents to what you are talking about. TiddlyWiki has very few
>> attributes of a normal programming language, I don't think that tiddlywiki
>> has the equivalent of a procedure from an imperative programming language.
>> You can use javascript in tiddlywiki, but in that case it is javascript,
>> not anything specific to tiddlywiki.
>>
>>
> Actually wikiText could be Turing complete (and possible easier to
> understand) if you had a syntax
> that is vaguely similar to conventional syntax. ie you have a set of
> things like this:
>
> <? if ?>
>     ...
> <? else ...?>
>
> <? endif ?>
>
> The problem with the widget syntax is that all the arguments
> get squashed into the head of the definition as keyword arguments
> and not placed syntactically in the body of the statement.
>
> If you had a syntax that reminded people of PHP you'd suddenly get
> thousands of new enthusiasts.
>
> Unfamiliar syntax scares off beginners - been there - done that
>
> Cheers
>
> /Joe
>
>
>
>
>
>> TiddlyWiki does allow a lot of flexibility using recursion and, in my
>> opinion at least, is something like declarative or functional programming.
>>
>>
>> That said, you can do if-then-else using lists like this:
>>
>> <$list filter='condition statement' emptyMessage=<<Else result>>>
>> Than result
>> </$list>
>>
>> as long as you can define your condition as a filter that returns one or
>> more results if true and no results if false. If you are comfortable with
>> set theory than the filtering operations in tiddlywiki are very powerful.
>>
>
> I'm familiar with list comprehensions - in fact my first WOW moment was
> when I realised
> that <<list-links "[tag[xyz]]">> was just predicate logic with a funny
> syntax.
>
> The filter is "just" a limited sub-set of Prolog with a kind of
> list-comprehension syntax.
>
> The feeling I get playing with tiddly wiki is that it is some kind of
> beautiful mixture of
> smalltalk and prolog and the browser DOM - all mixed together in very
> clever ways.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tiddlywiki+unsubscr...@googlegroups.com.
> To post to this group, send email to tiddlywiki@googlegroups.com.
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/tiddlywiki/4030277d-2605-4b12-9348-3199c7c6d9d0%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/4030277d-2605-4b12-9348-3199c7c6d9d0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CADeSwYOGx7CpdTBWxUKU%3D8rUgUPck7Oa6V3%3DQLCfMTHAnyiH5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to