Bug 20255 - Simple Loop Labeling

classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
Eureka!

I don't know why I didn't think of this earlier, but . . .

A simple way to get *some* level of control structure labeling . . .


So when finding the structure typed in the id of

 switch -- myLoop

instead of simply adding an end switch, the comment could be copied

 end switch -- myLoop


Better yet, perhaps, would be to insert "end " before the first word
of the comment.


--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
On 08/09/2017 01:39 PM, Dr. Hawkins via use-livecode wrote:

> Eureka!
>
> I don't know why I didn't think of this earlier, but . . .
>
> A simple way to get *some* level of control structure labeling . . .
>
>
> So when finding the structure typed in the id of
>
>   switch -- myLoop
>
> instead of simply adding an end switch, the comment could be copied
>
>   end switch -- myLoop
>
>
> Better yet, perhaps, would be to insert "end " before the first word
> of the comment.
>
>

I do this regularly with repeat statements and if/endif statments as
well, in fact the glx2 script editor does this automatically for me. It
helps keep me more or less sane, especially when dealing with nested
structures. Instead of a comment like "myLoop" I use the parameters to
the switch or repeat or if statement, so I end up with

switch word 1 of tLine
...
end switch -- word 1 of tLine

repeat for each item tItem in tList
...
end repeat -- for each item tItem in tList

if tVariable is not empty then
...
end if -- tVariable is not empty

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
Hi all,

I personally like this idea, and I find it pretty useful. And this does not
sound too difficult to implement.

But I am not sure if everyone will like it, so if we do it, we should
probably add a pref to turn it on/off.

The good news is that Ali has been doing some work on scriptifying the
Prefs stack, so in the future it will be easier to add Prefs for such
features.

Best,
Panos

On 10 Aug 2017 02:53, "Mark Wieder via use-livecode" <
[hidden email]> wrote:

> On 08/09/2017 01:39 PM, Dr. Hawkins via use-livecode wrote:
>
>> Eureka!
>>
>> I don't know why I didn't think of this earlier, but . . .
>>
>> A simple way to get *some* level of control structure labeling . . .
>>
>>
>> So when finding the structure typed in the id of
>>
>>   switch -- myLoop
>>
>> instead of simply adding an end switch, the comment could be copied
>>
>>   end switch -- myLoop
>>
>>
>> Better yet, perhaps, would be to insert "end " before the first word
>> of the comment.
>>
>>
>>
> I do this regularly with repeat statements and if/endif statments as well,
> in fact the glx2 script editor does this automatically for me. It helps
> keep me more or less sane, especially when dealing with nested structures.
> Instead of a comment like "myLoop" I use the parameters to the switch or
> repeat or if statement, so I end up with
>
> switch word 1 of tLine
> ...
> end switch -- word 1 of tLine
>
> repeat for each item tItem in tList
> ...
> end repeat -- for each item tItem in tList
>
> if tVariable is not empty then
> ...
> end if -- tVariable is not empty
>
> --
>  Mark Wieder
>  [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode

> On 10 Aug 2017, at 6:02 pm, panagiotis merakos via use-livecode <[hidden email]> wrote:
>
> I personally like this idea, and I find it pretty useful. And this does not
> sound too difficult to implement.
>
> But I am not sure if everyone will like it, so if we do it, we should
> probably add a pref to turn it on/off.
>
> The good news is that Ali has been doing some work on scriptifying the
> Prefs stack, so in the future it will be easier to add Prefs for such
> features.

I wonder whether a mouse over tooltip would work just as well. Is this something you want to be able to see _all_ the time or just if you get confused about where you are?

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
I do this, in my code, too.  I also label my else's (with the opposite of
the condition, of course)
4D's macros have a cool way of making this happen.
for example, to make a labeled if
type the text of the condition
Select the text
Insert the if macro
The condition is replaced with
if condition then
end if #condition
That's not entirely correct, because 4D uses the ` as the comment symbol,
but you get the idea.

If you use Levure, Trevor foolishly accepted my indent rules for
sublimeText.  I added an indent rule for blocks labeled like this
#<this is a block>
#</this is a block>
The code in such a block will be indented another level, which means I get
visual separation within the block, and I can fold it.

On Thu, Aug 10, 2017 at 6:00 AM, Monte Goulding via use-livecode <
[hidden email]> wrote:

>
> > On 10 Aug 2017, at 6:02 pm, panagiotis merakos via use-livecode <
> [hidden email]> wrote:
> >
> > I personally like this idea, and I find it pretty useful. And this does
> not
> > sound too difficult to implement.
> >
> > But I am not sure if everyone will like it, so if we do it, we should
> > probably add a pref to turn it on/off.
> >
> > The good news is that Ali has been doing some work on scriptifying the
> > Prefs stack, so in the future it will be easier to add Prefs for such
> > features.
>
> I wonder whether a mouse over tooltip would work just as well. Is this
> something you want to be able to see _all_ the time or just if you get
> confused about where you are?
>
> Cheers
>
> Monte
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
On 08/10/2017 03:00 AM, Monte Goulding via use-livecode wrote:

> I wonder whether a mouse over tooltip would work just as well. Is this something you want to be able to see _all_ the time or just if you get confused about where you are?

Hmmm... I think a tooltip could be especially useful for exit and break
statements in nested conditionals where it's not always obvious at first
glance.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
+1 on the tooltip. I also comment end statements in nested loops or control structures, but it gets cluttery when trying to read through the script.

Bob S


> On Aug 10, 2017, at 08:28 , Mark Wieder via use-livecode <[hidden email]> wrote:
>
> On 08/10/2017 03:00 AM, Monte Goulding via use-livecode wrote:
>
>> I wonder whether a mouse over tooltip would work just as well. Is this something you want to be able to see _all_ the time or just if you get confused about where you are?
>
> Hmmm... I think a tooltip could be especially useful for exit and break statements in nested conditionals where it's not always obvious at first glance.
>
> --
> Mark Wieder
> [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
It can, but as of now we don't have another good way of matching structures
on a permanent basis so that if you, for instance, remove the "if" or
"repeat" on the top, the "end if" or "end repeat" on the bottom goes away,
too, or if you change the condition the label on the end changes.

On Thu, Aug 10, 2017 at 11:39 AM, Bob Sneidar via use-livecode <
[hidden email]> wrote:

> +1 on the tooltip. I also comment end statements in nested loops or
> control structures, but it gets cluttery when trying to read through the
> script.
>
> Bob S
>
>
> > On Aug 10, 2017, at 08:28 , Mark Wieder via use-livecode <
> [hidden email]> wrote:
> >
> > On 08/10/2017 03:00 AM, Monte Goulding via use-livecode wrote:
> >
> >> I wonder whether a mouse over tooltip would work just as well. Is this
> something you want to be able to see _all_ the time or just if you get
> confused about where you are?
> >
> > Hmmm... I think a tooltip could be especially useful for exit and break
> statements in nested conditionals where it's not always obvious at first
> glance.
> >
> > --
> > Mark Wieder
> > [hidden email]
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
I like the tooltip idea. It's less invasive than altering the script
itself, yet still easy to access. Variable values work the same way and I
find that to be a good balance between accessibility and convenience.
--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com



On August 10, 2017 10:53:34 AM Mike Kerner via use-livecode
<[hidden email]> wrote:

> It can, but as of now we don't have another good way of matching structures
> on a permanent basis so that if you, for instance, remove the "if" or
> "repeat" on the top, the "end if" or "end repeat" on the bottom goes away,
> too, or if you change the condition the label on the end changes.
>
> On Thu, Aug 10, 2017 at 11:39 AM, Bob Sneidar via use-livecode <
> [hidden email]> wrote:
>
>> +1 on the tooltip. I also comment end statements in nested loops or
>> control structures, but it gets cluttery when trying to read through the
>> script.
>>
>> Bob S
>>
>>
>> > On Aug 10, 2017, at 08:28 , Mark Wieder via use-livecode <
>> [hidden email]> wrote:
>> >
>> > On 08/10/2017 03:00 AM, Monte Goulding via use-livecode wrote:
>> >
>> >> I wonder whether a mouse over tooltip would work just as well. Is this
>> something you want to be able to see _all_ the time or just if you get
>> confused about where you are?
>> >
>> > Hmmm... I think a tooltip could be especially useful for exit and break
>> statements in nested conditionals where it's not always obvious at first
>> glance.
>> >
>> > --
>> > Mark Wieder
>> > [hidden email]
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
If we're taking votes, respectfully count mine as -1 on using tooltips
for this.

Labels within code are most useful when visible.  If we need to read the
code carefully enough to figure out where we should aim the mouse, then
aim the mouse, then pause waiting for the tooltip to appear, the benefit
of labels is diminished.

I use comments, as most others here seem to do too.  Quite happy to just
keep doing that - it only costs two extra characters ("--"), is simple
and flexible, and immediately self-evident when skimming code.

--
  Richard Gaskin
  Fourth World Systems


Bob Sneidar wrote:

> +1 on the tooltip. I also comment end statements in nested loops or control structures, but it gets cluttery when trying to read through the script.
>
> Bob S
>
>
>> On Aug 10, 2017, at 08:28 , Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> On 08/10/2017 03:00 AM, Monte Goulding via use-livecode wrote:
>>
>>> I wonder whether a mouse over tooltip would work just as well. Is this something you want to be able to see _all_ the time or just if you get confused about where you are?
>>
>> Hmmm... I think a tooltip could be especially useful for exit and break statements in nested conditionals where it's not always obvious at first glance.
>>
>> --
>> Mark Wieder


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
Well, you don't actually have to use the tooltip. It wouldn't interfere
with your current method and would enhance the editor for those who don't
want the clutter.

Best of both worlds.
--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com



On August 10, 2017 1:22:44 PM Richard Gaskin via use-livecode
<[hidden email]> wrote:

> If we're taking votes, respectfully count mine as -1 on using tooltips
> for this.
>
> Labels within code are most useful when visible.  If we need to read the
> code carefully enough to figure out where we should aim the mouse, then
> aim the mouse, then pause waiting for the tooltip to appear, the benefit
> of labels is diminished.
>
> I use comments, as most others here seem to do too.  Quite happy to just
> keep doing that - it only costs two extra characters ("--"), is simple
> and flexible, and immediately self-evident when skimming code.
>
> --
>   Richard Gaskin
>   Fourth World Systems
>
>
> Bob Sneidar wrote:
>
>> +1 on the tooltip. I also comment end statements in nested loops or control
>> structures, but it gets cluttery when trying to read through the script.
>>
>> Bob S
>>
>>
>>> On Aug 10, 2017, at 08:28 , Mark Wieder via use-livecode <use-livecode at
>>> lists.runrev.com> wrote:
>>>
>>> On 08/10/2017 03:00 AM, Monte Goulding via use-livecode wrote:
>>>
>>>> I wonder whether a mouse over tooltip would work just as well. Is this
>>>> something you want to be able to see _all_ the time or just if you get
>>>> confused about where you are?
>>>
>>> Hmmm... I think a tooltip could be especially useful for exit and break
>>> statements in nested conditionals where it's not always obvious at first
>>> glance.
>>>
>>> --
>>> Mark Wieder
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
On Thu, Aug 10, 2017 at 1:02 AM, panagiotis merakos via use-livecode <
[hidden email]> wrote:

>
> I personally like this idea, and I find it pretty useful. And this does not
> sound too difficult to implement.
>

That was the flash of insight that triggered me:  something was *already*
happening that could bee piggy-backed.

>
> But I am not sure if everyone will like it, so if we do it, we should
> probably add a pref to turn it on/off.
>

That makes sense--but in my narrow proposal, it would only happen if
someone added the comment.

In fact, what I would *like* is modern Fortran style labelling or something
like that, and the ability to the those labels to controls like next and
exit.  This, however, would accomplish so much with so little.

In fact, I think I like Mark's labeling even better, if the preference
could be set to always include that moment on the terminating statement.

And Monte's mouseover tooltip, and the ability to jump to the matching end,
would be great . . .

While such things are being discussed, everyone realizes that indenting is
horribly broken in 8.x, don't they?
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode

> On 11 Aug 2017, at 4:55 am, J. Landman Gay via use-livecode <[hidden email]> wrote:
>
> Well, you don't actually have to use the tooltip. It wouldn't interfere with your current method and would enhance the editor for those who don't want the clutter.

Having thought about this a bit I think the issue with the tooltip is if it is worked out dynamically then if you’ve done something to stuff up your control structures then it won’t work out the right thing anyway… when the comments are most useful is in exactly that scenario so perhaps comments is the way to go for those that wan them.

So we need:

1. an optional way to add such comments (even users that want them might not want them unless they are making spaghetti)
2. automagical maintenance if the comments exist and you change the condition
3. work out whether tags rather than the actual condition is what people really want because the condition might add too much clutter:

if some complicated condition then # I’m a makin’ spaghetti
   — spaghetti
end if # I’m a makin' spaghetti

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
On 08/10/2017 06:24 PM, Monte Goulding via use-livecode wrote:

> So we need:
>
> 1. an optional way to add such comments (even users that want them might not want them unless they are making spaghetti)
> 2. automagical maintenance if the comments exist and you change the condition
> 3. work out whether tags rather than the actual condition is what people really want because the condition might add too much clutter:
>
> if some complicated condition then # I’m a makin’ spaghetti
>     — spaghetti
> end if # I’m a makin' spaghetti

I would actually argue against this. For me, the useful part would be

end if # some complicated condition

Otherwise, making the user come up with a comment that basically says
"some complicated condition" anyway, and doing all the maintentance
you've described above sounds like a lot of work for very little gain.

--
  Mark Wieder
  [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode

> On 11 Aug 2017, at 11:38 am, Mark Wieder via use-livecode <[hidden email]> wrote:
>
> I would actually argue against this. For me, the useful part would be
>
> end if # some complicated condition
>
> Otherwise, making the user come up with a comment that basically says "some complicated condition" anyway, and doing all the maintentance you've described above sounds like a lot of work for very little gain.

OK but:

if some complicated condition then

else if some other complicated condition then

else if some yet again complicated condition then

else

end if # what do you put here?
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
On 08/10/2017 06:40 PM, Monte Goulding via use-livecode wrote:

>
>> On 11 Aug 2017, at 11:38 am, Mark Wieder via use-livecode <[hidden email]> wrote:
>>
>> I would actually argue against this. For me, the useful part would be
>>
>> end if # some complicated condition
>>
>> Otherwise, making the user come up with a comment that basically says "some complicated condition" anyway, and doing all the maintentance you've described above sounds like a lot of work for very little gain.
>
> OK but:
>
> if some complicated condition then
>
> else if some other complicated condition then
>
> else if some yet again complicated condition then
>
> else
>
> end if # what do you put here?

I would code that as

switch someRelatedVariable
   case someComplicatedCondition
     break
   case someOtherComplicatedCondition
     break
   case someYetAgainComplicatedCondition
     break
   default
end switch -- someRelatedVariable

<g>

but otherwise, I assume the 'end if' is attached to the 'if' and use
that condition as the comment. The whole point of this isn't to create
useless comments, but to ensure that a large structure can still be
parsed visually. By the time I get to an 'end if' statement a few
screens down I'll want to know what the original 'if' statement was, and
with two spaces of indentation that's often hard to grok.

What would you put as a comment after the 'end if' using your proposed
approach? The original comment for the 'if' statement or something else?
Would you force the user to create comments for each 'else if' as well?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode

> On 11 Aug 2017, at 11:54 am, Mark Wieder via use-livecode <[hidden email]> wrote:
>
> What would you put as a comment after the 'end if' using your proposed approach? The original comment for the 'if' statement or something else? Would you force the user to create comments for each 'else if' as well?

I’m not sure if I proposed anything… was just wondering out loud… but yes I think if a tag approach is used then

if some complicated condition then # commontag

else if some other complicated condition then  # commontag

else if some yet again complicated condition then  # commontag

else  # commontag

end if  # commontag

Now you would know no matter how much spaghetti you write or how complicated your conditions are which control structure each if/else if/else/end if belongs to.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
I like and use  end if #some complicated condition

On Thu, Aug 10, 2017 at 10:02 PM, Monte Goulding via use-livecode <
[hidden email]> wrote:

>
> > On 11 Aug 2017, at 11:54 am, Mark Wieder via use-livecode <
> [hidden email]> wrote:
> >
> > What would you put as a comment after the 'end if' using your proposed
> approach? The original comment for the 'if' statement or something else?
> Would you force the user to create comments for each 'else if' as well?
>
> I’m not sure if I proposed anything… was just wondering out loud… but yes
> I think if a tag approach is used then
>
> if some complicated condition then # commontag
>
> else if some other complicated condition then  # commontag
>
> else if some yet again complicated condition then  # commontag
>
> else  # commontag
>
> end if  # commontag
>
> Now you would know no matter how much spaghetti you write or how
> complicated your conditions are which control structure each if/else
> if/else/end if belongs to.
>
> Cheers
>
> Monte
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
+100 To Mark for that one

In fact it could copy the complicated condition AND any comment after it -
best of all possible worlds

Lagi

On 11 August 2017 at 02:38, Mark Wieder via use-livecode <
[hidden email]> wrote:

> On 08/10/2017 06:24 PM, Monte Goulding via use-livecode wrote:
>
> So we need:
>>
>> 1. an optional way to add such comments (even users that want them might
>> not want them unless they are making spaghetti)
>> 2. automagical maintenance if the comments exist and you change the
>> condition
>> 3. work out whether tags rather than the actual condition is what people
>> really want because the condition might add too much clutter:
>>
>> if some complicated condition then # I’m a makin’ spaghetti
>>     — spaghetti
>> end if # I’m a makin' spaghetti
>>
>
> I would actually argue against this. For me, the useful part would be
>
> end if # some complicated condition
>
> Otherwise, making the user come up with a comment that basically says
> "some complicated condition" anyway, and doing all the maintentance you've
> described above sounds like a lot of work for very little gain.
>
> --
>  Mark Wieder
>  [hidden email]
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug 20255 - Simple Loop Labeling

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
On 2017-08-10 21:33, Dr. Hawkins via use-livecode wrote:
> In fact, what I would *like* is modern Fortran style labelling or
> something
> like that, and the ability to the those labels to controls like next
> and
> exit.  This, however, would accomplish so much with so little.

Thinking out loud here and taking into account suggestions people have
made in the past...

Naming loops in a syntactic way certainly sounds like a useful thing to
do:

repeat for each line tLine in tContainer named LineLoop
   repeat for each item tItem in tLine named ItemLoop
     if some complicated condition then
       exit repeat ItemLoop
     else if some other complicated condition then
       exit repeat LineLoop
     end if

     -- do other stuff
     if some even more complicated condition then
       next repeat LineLoop
     end if
   end repeat ItemLoop
end repeat LineLoop

Certainly 'exit repeat ...' would not be harmful, 'next repeat ...' I'd
have to analyze more deeply.

The main problem with GOTO (apart from the ability to create very hard
to understand code) is that it allows creation of what is called
'unstructured control-flow'. Basically that means that you have to work
*exceptionally* hard to untangle it in a compile to perform any sort of
reasonable optimization.

At present LiveCode only allows you to produce 'structured control
flow'. Adding 'next repeat ...', doesn't change that... However, 'next
repeat ...' is not so clear (I think it is probably fine, but need to
check some algorithmics).

The only other issue with the above (beyond implementing it) is the
syntax... It would reserve 'named' as a non-operator in this context. If
we did ever have reason to have 'X named Y' then in repeats you'd have
to do:

   repeat for each line tLine in (tContainer named ...) named ...

Although - without knowing what 'named' might do as an operator, or
being able to think of anything it could do - that is probably a safe
addition from that point of view.

(Of course we could use 'labelled' instead of 'named' in the repeat
context - 'labelled' seems for some reason less likely to be leveragable
as a binary operator!)

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
12
Loading...