Benefits/drawbacks with shadow tids using plugin path

84 views
Skip to first unread message

Mat

unread,
Sep 16, 2018, 4:54:01 PM9/16/18
to TiddlyWikiDev
How important is it to use the full plugin title, say $:/plugin/TWaddle/Foo , as prefix for the constituing shadow tids?

I ask because this makes for very long titles on shadow tids that are both difficult to read and error prone to type when referred to inside the plugin.

One specific tiddler that requires the full path is the "readme" for it to show as opened by default in the the plugin library. (BTW, I wish we could control what tab to open). Other than this one tiddler I know of no other aspects. Are there any?

...


On a related note; Peeking inside a plugin I observer that the json repeats the shadow titles twice: (Here scaled off to only show the title fields)

{
   
"tiddlers": {
       
"$:/plugin/TWaddle/Foo/Bar": {
           
"title": "$:/plugin/TWaddle/Foo/Bar"
       
},

       
"$:/plugin/TWaddle/Foo/Frotz": {
           
"title": "$:/plugin/TWaddle/Foo/Frotz"
       
}
   
}
}


Why is this?
Can this fact be used to somehow shorten the titles without negative consequences or must their mentions appear identical (which then again provokes why they're double to begin with)?

<:-)

PMario

unread,
Sep 17, 2018, 4:52:14 AM9/17/18
to TiddlyWikiDev

On Sunday, September 16, 2018 at 10:54:01 PM UTC+2, Mat wrote:
...
One specific tiddler that requires the full path is the "readme" for it to show as opened by default in the the plugin library. (BTW, I wish we could control what tab to open). Other than this one tiddler I know of no other aspects. Are there any?

The readme is a good example. If you name your readme: $:/readme and I do the same, the plugin which is initialized as the last one, will be the only one, which is active, because of the naming conflict.


 
On a related note; Peeking inside a plugin I observer that the json repeats the shadow titles twice: (Here scaled off to only show the title fields)

{
   
"tiddlers": {
       
"$:/plugin/TWaddle/Foo/Bar": {
           
"title": "$:/plugin/TWaddle/Foo/Bar"

Why is this?

The plugin tiddler is a container. The outer name is just like an "index" and is thrown away when plugins are initialized. .. Only the title field of the tiddler is used to create the shadow tiddler.
 
Can this fact be used to somehow shorten the titles without negative consequences or must their mentions appear identical (which then again provokes why they're double to begin with)?

You _can't_ use the plugin tiddler structure to shorten shadow tiddler names.

The outer name could be different in the future. It's just a coincident, that they are the same. That's why the plugin namespace is a convention to avoid naming conflicts.

have fun!
mario

Mat

unread,
Sep 17, 2018, 6:25:15 AM9/17/18
to TiddlyWikiDev
Ok, so the plugin prefix is to prevent conflicts. That makes sense.
 
 
> (BTW, I wish we could control what tab to open). 
 

Actually not quite; it is exclusively "readme" that is opened by default. No other tab is presented open by default even if first in list. Instead the user sees a somewhat silly looking row of closed tabs (#1902)

  
The plugin tiddler is a container. The outer name is just like an "index" and is thrown away when plugins are initialized. .. Only the title field of the tiddler is used to create the shadow tiddler.  [...] The outer name could be different in the future. It's just a coincident, that they are the same. That's why the plugin namespace is a convention to avoid naming conflicts. 

Interesting and good to know. Seems like an under-used opportunity. Even if they are "thrown away", they're still there so maybe they could be interpreted as paths to all tiddlers in the plugin so that we could really title the shadow tiddlers with pretty names.


Mario, thanks for your kind reply. 

<:-)


PMario

unread,
Sep 17, 2018, 6:37:57 AM9/17/18
to TiddlyWikiDev
On Monday, September 17, 2018 at 12:25:15 PM UTC+2, Mat wrote:
Ok, so the plugin prefix is to prevent conflicts. That makes sense.
 
 
> (BTW, I wish we could control what tab to open). 
 

Actually not quite; it is exclusively "readme" that is opened by default. No other tab is presented open by default even if first in list. Instead the user sees a somewhat silly looking row of closed tabs (#1902)

PMario

unread,
Sep 17, 2018, 6:42:35 AM9/17/18
to tiddly...@googlegroups.com
On Monday, September 17, 2018 at 12:25:15 PM UTC+2, Mat wrote:

Interesting and good to know. Seems like an under-used opportunity. Even if they are "thrown away", they're still there so maybe they could be interpreted as paths to all tiddlers in the plugin so that we could really title the shadow tiddlers with pretty names.

No ... You can't rely on the outer name. They basically can be anything.

It's an implementation detail. The core code dealing with the json structure is simpler and may be more efficient this way. I would strongly recommend, to _not_ "mis-use" it.

-m

PMario

unread,
Sep 17, 2018, 6:44:08 AM9/17/18
to TiddlyWikiDev
On Monday, September 17, 2018 at 12:42:35 PM UTC+2, PMario wrote:

It's an implementation detail. The core code dealing with the json structure is simpler and may be more efficient this way. I would strongly recommend, to _not_ "mis-use" it.

edited the last post :)

Mat

unread,
Sep 17, 2018, 7:01:14 AM9/17/18
to TiddlyWikiDev
Actually not quite; it is exclusively "readme" that is opened by default. No other tab is presented open by default even if first in list. Instead the user sees a somewhat silly looking row of closed tabs (#1902)


Just cecked it. I use default TW core.


Oh! Terrific! Thanks for pointing it out!

<:-)

TonyM

unread,
Sep 17, 2018, 8:36:20 PM9/17/18
to TiddlyWikiDev
Mat,

I am not sure if this helps

People wiser than me can set me strait If I have it wrong, but after packaging a few plugins under the $:/plugins I also started including tiddlers outside this name but Ensured they have a reasonable chance of not colliding, I include tiddlers in my own prefix $:/PSaT/ and then use a caption for pretty links in the side bar. I have also created non $:/ tiddlers that transclude one of the installed tiddlers. eg "Columns Manager" containing $:/PSaT/Columns, I try to at least not use a tiddler name already existing in TiddlyWiiki.com or any other plugin I am aware of.

Regards
Tony

PMario

unread,
Sep 18, 2018, 3:39:31 AM9/18/18
to TiddlyWikiDev
On Tuesday, September 18, 2018 at 2:36:20 AM UTC+2, TonyM wrote:
...
I also started including tiddlers outside this name but Ensured they have a reasonable chance of not colliding,

The problem I see is, that "a reasonable chance" is not enough, except it's your dev-prefix mentioned below.
 
I include tiddlers in my own prefix $:/PSaT/ and then use a caption for pretty links in the side bar.

IMO that should be OK.
 
I have also created non $:/ tiddlers that transclude one of the installed tiddlers. eg "Columns Manager" containing $:/PSaT/Columns, I try to at least not use a tiddler name already existing in TiddlyWiiki.com or any other plugin I am aware of.

"name clashing" issues are very hard to find for users and can result in increased maintenance for the whole community. We have to consider, that plugins will live for 10+ years.

As plugin authors we should really try very hard to avoid them. Even if it means we have more work. The "return on investment" is huge, because the time wasted by fixing naming conflict can be dramatic.

just my thoughts
mario

TonyM

unread,
Sep 19, 2018, 9:32:23 AM9/19/18
to TiddlyWikiDev
Mario,

I agree with what you are saying. Perhaps we could find a method even provide a macro or addition to the search to assist.

For example my MyMenus plugin has a system tiddler for managing menus, it would be nice if on an installed wiki we could type mymenus or mym in the search and see "mymenus manager" as a result and on clicking opens the system tiddler. There would then be no risk of a colision but still permit user friendly names.

Perhaps allowing captions to be searched by default returning captions as if they were tiddlers.

But then $:/psat/mymenusManager looks ugly once its open. Perhaps a special field in system tiddlers could allow a caption like field display instead of the true tiddler title with the true title in the subtitle. In effect allowing system tiddlers to apear to be regular tiddlers.

By removing these limitations people will be happy to use unique prefixes.

I would also like to see a self serve registry.

Regards
Tony

Jeremy Ruston

unread,
Sep 20, 2018, 4:07:43 AM9/20/18
to tiddly...@googlegroups.com
How important is it to use the full plugin title, say $:/plugin/TWaddle/Foo , as prefix for the constituing shadow tids?

It is mostly only a convention that the title of shadow tiddlers be prefixed with the title of the plugin from which they came. The purpose of the convention is to reduce the chance of accidental clashes between different plugins, and to make it easier for users to understand where tiddlers come from.

The core plugin shows some of the many reasons we sometimes break the convention:

* For "friendly" system tiddler titles, like $:/ControlPanel, $:/TagManager etc.
* To overwrite a shadow tiddler from another plugin
* To set a core configuration value $:/config/xxxx 

I ask because this makes for very long titles on shadow tids that are both difficult to read and error prone to type when referred to inside the plugin.

Yes, the trade-off is that these long tiddler titles, if carefully chosen, allow the purpose of the tiddler to be described with clarity.

One specific tiddler that requires the full path is the "readme" for it to show as opened by default in the the plugin library. (BTW, I wish we could control what tab to open). Other than this one tiddler I know of no other aspects. Are there any?

I think the one part of the core that relies on the plugin title prefix is the one you mention: the mechanism for displaying content tabs in the plugin view.

On a related note; Peeking inside a plugin I observer that the json repeats the shadow titles twice: (Here scaled off to only show the title fields)

{
   
"tiddlers": {
       
"$:/plugin/TWaddle/Foo/Bar": {
           
"title": "$:/plugin/TWaddle/Foo/Bar"
       
},

       
"$:/plugin/TWaddle/Foo/Frotz": {
           
"title": "$:/plugin/TWaddle/Foo/Frotz"
       
}
   
}
}


Why is this?

That's a hashmap: it's an efficient way to look up a string and get back an object. It allows us to efficiently implement the subtiddler operations that are extensively used in e.g. the plugin view code.

The alternative would be an array, which would look like this:

[
        {
            "title": "$:/plugin/TWaddle/Foo/Bar"
        },
        {
            "title": "$:/plugin/TWaddle/Foo/Frotz"
        }
]

The array format obviates the repetition of the title, but at the expense of much less efficiency: we'd have to scan through the array to find a particular tiddler.

Can this fact be used to somehow shorten the titles without negative consequences or must their mentions appear identical (which then again provokes why they're double to begin with)?

I'm not sure what you're trying to solve here. There only negative consequences to shortening tiddler titles within a plugin are the increased chances of a clash. There's nothing to stop a plugin called "Quatux" adopting the convention "$:/Q/" as a prefix, there's just a higher risk of a clash.

Best wishes

Jeremy


<:-)

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/3b7d929e-d5e8-4780-9154-cdfe9d07465e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages