self('caption') and self('base') report differently

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

self('caption') and self('base') report differently

Post by altoclef »

I've found a situation where self('caption') and self('base') report differently.

Sorry, the code has to be split into multiple scripts, but I hope the sysdebug output helps map the call stack (N.B. I use '^^' to filter the output in DebugView).

Put these 4 scripts into a single folder and then load script1.

script1.xys

Code: Select all

"script1init"
{
    sysdebug '^^ DBGVIEWCLEAR';
    sysdebug '^^ This is script1';

    load '.\script2.xyi';

    sysdebug '^^ In script1 : calling Script2Function';
    Script2Function();
}

function Script1Callback()
{
    sysdebug '^^ This is Script1Callback';
    Script3Function();
}
script2.xyi

Code: Select all

"script2init"
{
    sysdebug '^^ This is script2';
    
    load '.\script3.xyi';
    load '.\script4.xyi';
}

function Script2Function()
{
    sysdebug '^^ This is Script2Function';
    Script1Callback();
}
script3.xyi

Code: Select all

"script3init"
{ 
    sysdebug '^^ This is script3';
}

function Script3Function()
{
    sysdebug '^^ This is Script3Function';

    text
        'In Script3Function()' . <crlf> .
        '====================' . <crlf> .
        'self(caption): ' . <crlf> .
        'self   : ' . self('caption') . <crlf> .
        'self -1: ' . self('caption', -1) . <crlf> . 
        'self -2: ' . self('caption', -2) . <crlf> . 
        'self -3: ' . self('caption', -3) . <crlf 2> . 
        'self(base): ' . <crlf> .
        'self   : ' . self('base') . <crlf> . 
        'self -1: ' . self('base', -1) . <crlf> . 
        'self -2: ' . self('base', -2) . <crlf> . 
        'self -3: ' . self('base', -3);
}
script4.xyi

Code: Select all

"script4init" 
{
    sysdebug '^^ This is script4';
}
The sysdebug output is:
[4992] ^^ This is script1
[4992] ^^ This is script2
[4992] ^^ This is script3
[4992] ^^ This is script4
[4992] ^^ In script1 : calling Script2Function
[4992] ^^ This is Script2Function
[4992] ^^ This is Script1Callback
[4992] ^^ This is Script3Function
which is what I expect. However, the script output is:
In Script3Function()
====================
self(caption):
self : function script3function
self -1: function script1callback
self -2: function script2function
self -3: script1init

self(base):
self : script4
self -1: script4
self -2: script4
self -3: script1
The two sections are not consistent with each other. The first section is what I expect, but not the second – script4 is the last script that was loaded (in script2) but it has not called any subsequent code. I expect the second section to report:
self : script3
self -1: script1
self -2: script2
self -3: script1
Have I misunderstood how self works or is this a bug?

admin
Site Admin
Posts: 64695
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: self('caption') and self('base') report differently

Post by admin »

Could you pack the 4 files into a ZIP and append it?

altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Re: self('caption') and self('base') report differently

Post by altoclef »

TestSelf.7z
(529 Bytes) Downloaded 123 times

admin
Site Admin
Posts: 64695
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: self('caption') and self('base') report differently

Post by admin »

Confirmed. I put it on the after-TB list.

altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Re: self('caption') and self('base') report differently

Post by altoclef »

Thanks. :tup:

altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Re: self('caption') and self('base') report differently

Post by altoclef »

admin wrote: 06 Apr 2025 19:16 Confirmed. I put it on the after-TB list.
Now that you've released the first TB version, are you able to look at this issue please?

admin
Site Admin
Posts: 64695
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: self('caption') and self('base') report differently

Post by admin »

Not yet. tB still needs to improve a little.

altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Re: self('caption') and self('base') report differently

Post by altoclef »

admin wrote: 06 Oct 2025 08:49 Not yet. tB still needs to improve a little.
OK, I understand. Thanks.

How will I know when it's good enough for you to begin looking at the backlog of issues such as this one? I don't want to add to your workload by asking too often. :)

admin
Site Admin
Posts: 64695
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: self('caption') and self('base') report differently

Post by admin »

It is still beta. Check here for the release of v1.0, which is scheduled for Dec 19th 2025: https://github.com/twinbasic/twinbasic/releases

altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Re: self('caption') and self('base') report differently

Post by altoclef »

admin wrote: 06 Oct 2025 09:05 It is still beta. Check here for the release of v1.0, which is scheduled for Dec 19th 2025: https://github.com/twinbasic/twinbasic/releases
Thanks. :tup:

Post Reply