Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Dar Scott

> On Jun 7, 2016, at 1:37 PM, Dr. Hawkins  wrote:
> 
> Not being able to exit an
> outer loop (or, for that matter, to identify the companion beginning of a
> control structure, takes odd contortions for the first and several minutes
> at a time for the second.

I like the almost self-referential nature of this sentence.

Are you talking about editing?  Then I agree greatly.  I do get lost in 
structures.  I would appreciate the editor helping me.  I sometimes avoid deep 
nesting or many lines between structure boundaries by ending some error 
handling with a return or a throw.  Mostly, I try to find some meaning for the 
innermost loop and break that out as a separate function, especially something 
I can use elsewhere.  That lowers my need for block scoped variables, too.  (If 
I know the loop won't have a lot of iterations, I break down the content of the 
innermost into meaningful parts, too.)

So, I agree with editor help.  (Assuming I grok'd this right.)

Dar

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Monte Goulding
What I think we could do which I personally feel would be a bug fix is if a 
variable is declared with an initial value then reassign it if we iterate over 
the local command again.

For example:

repeat 
local tIndex = 1
-- tIndex is always 1 here
repeat
add 1 to tIndex
end repeat
end repeat

Sent from my iPhone

> On 8 Jun 2016, at 1:19 AM, Peter TB Brett  wrote:
> 
> Unfortunately, as I understand it we can't do this at the moment without 
> breaking backwards compatibility. :-(


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Dr. Hawkins
On Tue, Jun 7, 2016 at 11:27 AM, Mike Kerner 
wrote:

> I respectfully disagree.
>

It all depends upon what you are doing.

I, by necessity, have layers of nested loops.  Not being able to exit an
outer loop (or, for that matter, to identify the companion beginning of a
control structure, takes odd contortions for the first and several minutes
at a time for the second.

Strong typing, even optional strong typing, would be a speed advantage when
repeatedly handling math, for example--if theVals[] will only hold integers
(e.g., pennies), and I regularly sum them, it's simply faster for the code
to know that they're integers instead of converting them.

And when you have not alternative but 10K+ lines of script, and handlers
that are unavoidably several hundred lines, being able to localize
variables is a Godsend; you don't have to worry about whether you used the
same obvious name elsewhere, and whether you'll get side affect.




-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Mike Kerner
I respectfully disagree.

On Tue, Jun 7, 2016 at 1:27 PM, Dr. Hawkins  wrote:

> On Tue, Jun 7, 2016 at 8:51 AM, Peter TB Brett 
> wrote:
>
> > Lexically-scoped variables are completely incompatible with the current
> > execution model of LiveCode Script.  If you changed it, it would be from
> > many perspectives a different language.
> >
>
> So are things such as strict compilation, case dependency, and the like
> (which I think should be defaults, but . . .).
>
> I do see lexical scope, named control structures, and the availability of
> strong typing as absolutely critical for the longterm (even to the level of
> being a a go/nogo issue).
>
>
> --
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Dar Scott
In LiveCode, I tend to use small private functions.  In a twisted sense, a 
handler that calls those does have block-based lexically scoped variables, the 
block is just pushed into a separate function.  

On those occasions that I do write long handlers (for whatever excuse), I 
sometimes pretend that variables are block scoped for documentation reasons.  I 
declare the variables right before the section they are used in.  This might be 
confusing for others reading my code, though, so I minimize this.  

I also use 'it' as though it has block scope and try not to let its life go 
beyond the chunks of a handler as my brain sees them.  Clear use of 'it' often 
avoids the need of a variable.  (Though a variable with a good name helps with 
documentation at times.)  

So, for me, other improvements in compiling without language changes are more 
important.

Dar



> On Jun 7, 2016, at 11:27 AM, Dr. Hawkins  wrote:
> 
> On Tue, Jun 7, 2016 at 8:51 AM, Peter TB Brett 
> wrote:
> 
>> Lexically-scoped variables are completely incompatible with the current
>> execution model of LiveCode Script.  If you changed it, it would be from
>> many perspectives a different language.
>> 
> 
> So are things such as strict compilation, case dependency, and the like
> (which I think should be defaults, but . . .).
> 
> I do see lexical scope, named control structures, and the availability of
> strong typing as absolutely critical for the longterm (even to the level of
> being a a go/nogo issue).
> 
> 
> -- 
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Dr. Hawkins
On Tue, Jun 7, 2016 at 8:51 AM, Peter TB Brett 
wrote:

> Lexically-scoped variables are completely incompatible with the current
> execution model of LiveCode Script.  If you changed it, it would be from
> many perspectives a different language.
>

So are things such as strict compilation, case dependency, and the like
(which I think should be defaults, but . . .).

I do see lexical scope, named control structures, and the availability of
strong typing as absolutely critical for the longterm (even to the level of
being a a go/nogo issue).


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Peter TB Brett

On 07/06/2016 16:43, Ralph DiMola wrote:

What about an enable "lexically-scoped variables in LCS" option check box in
preferences or maybe an option in the stack so "lexically-scoped variables
in LCS" is scoped by stack? The latter is probably the better option so
existing library stacks won't be affected but a new main stack can have
"lexically-scoped variables in LCS" enabled.


Lexically-scoped variables are completely incompatible with the current 
execution model of LiveCode Script.  If you changed it, it would be from 
many perspectives a different language.


I believe that Mark Waddingham has a plan, at some point in the future, 
to change the LiveCode engine so that LCS is _also_ compiled to bytecode 
and run in the same VM that LCB is.  Because variable scope is 
determined at compile time, you could then have multiple "versions" of 
the LCS language, which could all be run simultaneously and interact 
with each other without any problems.  However, this would be a huge 
project (in fact, the project is, fundamentally, the long term "Open 
Language" goal).


On 07/06/2016 16:45, Mike Kerner wrote:
> ick.  Ick all the way around.  More of "this me".
>

Yes, I'd personally like to avoid "ick" if possible.

Peter

--
Dr Peter Brett 
LiveCode Technical Project Manager

LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Mike Kerner
ick.  Ick all the way around.  More of "this me".

On Tue, Jun 7, 2016 at 11:43 AM, Ralph DiMola <rdim...@evergreeninfo.net>
wrote:

> What about an enable "lexically-scoped variables in LCS" option check box
> in
> preferences or maybe an option in the stack so "lexically-scoped variables
> in LCS" is scoped by stack? The latter is probably the better option so
> existing library stacks won't be affected but a new main stack can have
> "lexically-scoped variables in LCS" enabled.
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdim...@evergreeninfo.net
>
> -Original Message-
> From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On
> Behalf
> Of Peter TB Brett
> Sent: Tuesday, June 07, 2016 11:19 AM
> To: How to use LiveCode
> Subject: Re: "LiveCode Infinity": lexically-scoped variables and bytecode
> blocks
>
> On 07/06/2016 16:04, Dr. Hawkins wrote:
> > On Tue, Jun 7, 2016 at 4:05 AM, Peter TB Brett
> > <peter.br...@livecode.com>
> > wrote:
> >
> >> Variables in LCB are going to become lexically scoped (
> >> https://github.com/livecode/livecode/pull/4113).  This means that
> >> variables declared inside an "if" or "repeat" block won't be
> >> accessible after the end of that block.
> >>
> >
> > To have this in livecode itself is on my top 3 list . . .
>
> Me too!
>
> Unfortunately, as I understand it we can't do this at the moment without
> breaking backwards compatibility. :-(
>
>  Peter
>
> --
> Dr Peter Brett <peter.br...@livecode.com> LiveCode Technical Project
> Manager
>
> LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Ralph DiMola
What about an enable "lexically-scoped variables in LCS" option check box in
preferences or maybe an option in the stack so "lexically-scoped variables
in LCS" is scoped by stack? The latter is probably the better option so
existing library stacks won't be affected but a new main stack can have
"lexically-scoped variables in LCS" enabled.

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Peter TB Brett
Sent: Tuesday, June 07, 2016 11:19 AM
To: How to use LiveCode
Subject: Re: "LiveCode Infinity": lexically-scoped variables and bytecode
blocks

On 07/06/2016 16:04, Dr. Hawkins wrote:
> On Tue, Jun 7, 2016 at 4:05 AM, Peter TB Brett 
> <peter.br...@livecode.com>
> wrote:
>
>> Variables in LCB are going to become lexically scoped ( 
>> https://github.com/livecode/livecode/pull/4113).  This means that 
>> variables declared inside an "if" or "repeat" block won't be 
>> accessible after the end of that block.
>>
>
> To have this in livecode itself is on my top 3 list . . .

Me too!

Unfortunately, as I understand it we can't do this at the moment without
breaking backwards compatibility. :-(

 Peter

--
Dr Peter Brett <peter.br...@livecode.com> LiveCode Technical Project Manager

LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Dr. Hawkins
On Tue, Jun 7, 2016 at 4:05 AM, Peter TB Brett 
wrote:

> Variables in LCB are going to become lexically scoped (
> https://github.com/livecode/livecode/pull/4113).  This means that
> variables declared inside an "if" or "repeat" block won't be accessible
> after the end of that block.
>

To have this in livecode itself is on my top 3 list . . .


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: "LiveCode Infinity": lexically-scoped variables and bytecode blocks

2016-06-07 Thread Paul Dupuis
On 6/7/2016 7:05 AM, Peter TB Brett wrote:
> The second new feature is the "bytecode" block
> (https://github.com/livecode/livecode/pull/4097).  This lets you write
> blocks of raw LCB bytecode in your LCB source files.  At the moment
> there are not very many places where this is likely to be useful, but
> in the future when we add more bytecodes (as part of the "LiveCode
> Infinity" project) bytecode blocks will let us write much more of LCB
> in LCB.
>
> I believe that "unsafe" blocks and "unsafe" handlers will be added
> soon.  These will be used to mark code that does risky direct memory
> manipulation. 

Peter,

LCS and LCB code is generally human readable (to the extent of the
knowledge of the reader). Bytecode is much less readable. Is LiveCode,
Ltd or the Open Source effort doung anything to screen for Widgets with
malware hidden in blocks of byte code?


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode