LCB still missing much functionality

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

LCB still missing much functionality

Post by mwieder » Sun Oct 01, 2017 4:03 am

Coming back into LCB after being away for a while... it's still pretty dismal in LC9dp9:

There is still no switch statement, so I'm ending up with multi-stage, multi-level if/else-if statements that are on the edge of readability. I know it was a conscious decision *not* to have a switch statement, but the logic there is baffling.

I thought by now we'd be able to define constants.
All I get is a syntax error.

I'm trying to convert some code from LCS that would be much better as a widget. Apparently this isn't a good idea.
There's no "exists" function? And no alternative "there is a" function?
There's no "exit handler" function?
I can create rectangles on the canvas and put text in them, but I can't group them?

Debugging is still circa-1980 log statements.
And that's only if you can get past the Syntax Errors at compilation time.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: LCB still missing much functionality

Post by [-hh] » Sun Oct 01, 2017 7:39 am

A few words in defense of LCB.
mwieder wrote:There is still no switch statement ...
Yes, I agree here, miss that too. And I miss most strongly the possibility to set the widget's rectangle within its parent, without using LCS.
I thought by now we'd be able to define constants.
No, we are able.

Code: Select all

constant <kName> is <value> -- string, number, list, array, boolean, ...
I'm trying to convert some code from LCS that would be much better as a widget. Apparently this isn't a good idea.
Yes. This is my point of view: LCB/widgets open things you can't have in LCS, say open "new horizons".
(What could help, for example, with at least 50% of the current "complaints" on the use-list).
If something works good and fast in LCS there is, TMHO, no need and mostly no advantage from "converting" to LCB.
There's no "exists" function? And no alternative "there is a" function?
Yes (not for LCS-objects). But when writing 16 widgets I needed that one time.
There's no "exit handler" function?
No, essentially we have. Simply return from the handler.

Code: Select all

handler myAnswer(in pNum as Number) returns String
   if pNum is not 5 then
      return ""
   else
      --
   end if
end handler
I can create rectangles on the canvas and put text in them, but I can't group them?
What does "grouping" mean here? To which goal?
For using canvas operation you can have layers or (sadly currently defunct in linux) grouping by save/restore

Code: Select all

begin layer on this canvas
   --
 end layer on this canvas

save state of this canvas -- saves especially current transform
   -- 
restore state of this canvas -- restores especially saved transform
For grouping messages you can build your own "cursor rects" and can have full control to which kind of clicks and to which click locations your widget reacts.

Debugging is still circa-1980 log statements.
Syntax errors are always in the indicated line -1.
And a runtime error is pretty much exact, telling variable type errors and possible "solutions".
And that's only if you can get past the Syntax Errors at compilation time.
You, one of the masters of debugging, are kidding here. :-)

It's pretty clear for me that, faster than I did, you too will be one of the strongest defenders/supporters of LCB.
I needed 60 full days (one day each week) to arrive to there.
shiftLock happens

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: LCB still missing much functionality

Post by mwieder » Sun Oct 01, 2017 4:25 pm

I thought by now we'd be able to define constants.

No, we are able.

constant <kName> is <value> -- string, number, list, array, boolean, ...
Hmmm... I get the dreaded "Syntax Error" for

Code: Select all

constant kSections is "1,2,4,8,16"
There's no "exit handler" function?

No, essentially we have. Simply return from the handler.
Doh. Of course. Thanks. :shock:

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: LCB still missing much functionality

Post by [-hh] » Sun Oct 01, 2017 5:08 pm

mwieder wrote:Hmmm... I get the dreaded "Syntax Error" for

Code: Select all

constant kSections is "1,2,4,8,16"
This works here. Did you already check that your lcb file is UTF-8 encoded?
Or for "gremlins" in pasted code?
shiftLock happens

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: LCB still missing much functionality

Post by mwieder » Sun Oct 01, 2017 6:20 pm

Aha! You can't have constants declared inside handlers.
It works if I declare the constant at the root of the script.

Stupid parser.
This is really needing something better than "Syntax Error".

Post Reply

Return to “LiveCode Builder”