LC Builder for sleepy types?
Peter TB Brett
peter.brett at livecode.com
Tue Apr 28 04:41:19 EDT 2015
On 2015-04-28 07:43, Richmond wrote:
> Like me!
>
> Is there any way to convert small LC scripts into the LC Builder
> language?
>
> While the LC 8 DPs provide "a first look at LiveCode’s new “LiveCode
> Builder” language", there is no
> comprehensive guide to LC Builder . . .
>
> . . . is there something like this lurking on a computer up at the
> mothership in Edinburgh?
>
> . . . is something like this going to be made available for those who
> do not intuitively grasp
> a new programming language on the basis of a few, fairly scanty
> examples?
Hi Richmond,
Although you can write a lot of LiveCode Script (LCS) programs in
LiveCode Builder (LCB), it's not really practical to write a tool to
automatically transform LCS programs to LCB. There are a number of
reasons for this:
- the LCB language does work in quite a different way to Script; many
programs in LCS just wouldn't be written in the same way in LCB. For
example, LCB has a "List" type, which isn't present in LCS, but is
incredibly useful.
- LCB is a lot stricter than Script in many respects; programs that take
advantage of LCS's tolerant and forgiving nature would generate a lot of
errors.
- currently, the LCB standard library is a lot smaller and far less
incomplete than LCS's. For example, if you're running LC 8 on Windows,
you currently can't even access files without either calling low-level
platform C APIs (which you *can* do directly from LCB!) or calling into
LCS. Many quick and useful LCS programs can't be written in LCB -- yet.
- at the moment the LCB virtual machine (the bit of LC8 that *runs* a
compiled LCB program) is a bit slow. For many programs, you wouldn't
get much of a speed-up from converting to LCB -- or it might even run
slower!
All of those points sound really quite negative, but in reality LCB is
very good and useful, and I am currently doing the *vast* majority of my
LiveCode programming in LCB rather than using LiveCode Script.
Also, LCB is *really good* for writing widgets! LCB's graphics syntax
is very easy to use, and a widget can render custom graphics far more
quickly and efficiently than LiveCode's "traditional" method for drawing
custom graphics. In LC 8, many parts of the IDE are now implemented
using widgets, and the overall result is for a much more responsive and
robust experience.
I really recommend reading these blog posts for examples of what can be
achieved with LCB widgets (and how to create them):
http://livecode.com/the-evolution-of-dragons/
http://www.bluemangolearning.com/livecode/2015/04/creating-a-busy-indicator-in-livecode-builder/
http://www.bluemangolearning.com/livecode/2015/03/creating-a-slider-widget/
http://www.bluemangolearning.com/livecode/2015/03/dawn-of-the-planet-of-the-widgets/
More internal blog posts are definitely on the cards -- I've been
talking to some of the other people on our team about it this morning,
and (as I understand it) there should be at least one LCB-focussed blog
post coming out in the next week.
LCB can be used to write things that aren't widgets, too. It can be
used to add functions and commands to LCS by creating extension
libraries. Recently I wrote a complete JSON parser/generator in pure
LiveCode Builder, which you can find here:
https://gist.github.com/peter-b/b54ba5587af240589513
This library is significantly faster than the LiveCode Script "EasyJSON"
stack (https://github.com/luxlogica/easyjson) -- but, alas, it is still
much slower than Monte's mergJSON.
Hope some of that helps.
Peter
--
Dr Peter Brett <peter.brett at livecode.com>
LiveCode Engine Development Team
More information about the use-livecode
mailing list