Re: The selectedObjects - is it a container or not?
Richard: > I wholeheartedly agree. ... > I'm putting together a little plan to move that vision > forward for a new generation of programmers. Good! That's what we need. Although HC itself is history, the reasons for its success can hold a lot of promise for the future. Best wishes, Curry K. ___ 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: The selectedObjects - is it a container or not?
Curry Kenworthy wrote: > Richard: >> What LiveCode brings to the modern world is a high-level >> scripting language distinguished not by any conformance to >> the rules of English, but by being among the very few that >> include support for GUI controls as inherent language elements. > > Just a brief reply here to note that there's more to the story. > LiveCode's implementation of English-like scripting has some > extremely special features, it is indeed a valuable syntax for those > seeking an intuitive language or English-like language, and that fact > hasn't changed, despite the world having more options today. There > are very sound reasons why this particular language (or language > family) could be valuable to a new generation of coders. I wholeheartedly agree. You may have noticed I use LiveCode. :) In fact, I agree that the potential for LiveCode to achieve its rightful place among the world's great language is so strong that I'm putting together a little plan to move that vision forward for a new generation of programmers. More on that very soon -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ 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: The selectedObjects - is it a container or not?
Richard: What LiveCode brings to the modern world is a high-level scripting language distinguished not by any conformance to the rules of English, but by being among the very few that include support for GUI controls as inherent language elements. Just a brief reply here to note that there's more to the story. LiveCode's implementation of English-like scripting has some extremely special features, it is indeed a valuable syntax for those seeking an intuitive language or English-like language, and that fact hasn't changed, despite the world having more options today. There are very sound reasons why this particular language (or language family) could be valuable to a new generation of coders. Best wishes, Curry K. ___ 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: The selectedObjects - is it a container or not?
Bob Sneidar wrote: > On Apr 19, 2017, at 09:58 , Richard Gaskin wrote: >> >> E.g. this: >> >> put arrayEncode( the customProperties["Prefs"] of stack "Prefs" ) \ >>into url ("binfile:"& specialFolderPath("Preferences") & \ >>"/MyPrefs.dat" ) >> >> ...is readable enough, but far from English. > > I would not do it that way. To make it more readable I would use: > > put the customProperties["Prefs"] of stack "Prefs" into tPrefs > put "binfile:"& specialFolderPath("Preferences") & "/MyPrefs.dat" > into tFilePath > put arrayEncode(tPrefs) into url tFilePath > > That is english readable... I checked my OED and I couldn't turn up an entry for customProperties, binfile, or arrayEncode, URL is defined differently, and none of the expressions I've seen in Fowler's Modern English Usage require square brackets or stray ampersands outside of quoted material. ;) > ...as much as can be expected. Exactly. Computers aren't people; no programming language, even the readable ones like Lua and LiveCode, will bear much resemblance to English. The team has removed most references to "English-like" from the lc.com and .org sites, and the more I spend time with other scripting languages the less I use the phrase myself. > I think that trying to make the code compact is counter to making the > code readable. Agreed, though there is sometimes a satisfying sense of completeness to a single statement with nested expressions that does so much. -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ 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: The selectedObjects - is it a container or not?
I would not do it that way. To make it more readable I would use: put the customProperties["Prefs"] of stack "Prefs" into tPrefs put "binfile:"& specialFolderPath("Preferences") & "/MyPrefs.dat" into tFilePath put arrayEncode(tPrefs) into url tFilePath That is english readable as much as can be expected. I think that trying to make the code compact is counter to making the code readable. MHO Bob S On Apr 19, 2017, at 09:58 , Richard Gaskin via use-livecode> wrote: E.g. this: put arrayEncode( the customProperties["Prefs"] of stack "Prefs" ) \ into url ("binfile:"& specialFolderPath("Preferences") & \ "/MyPrefs.dat" ) ...is readable enough, but far from English. ___ 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: The selectedObjects - is it a container or not?
Graham Samuel wrote: > I know really that the ‘the’ indicates a function... The use of "the" for both properties and some (but not all) functions is among the few mistakes the original HyerTalk team made. If "the" were used exclusively for properties, there would be no confusing ambiguity. Worse, using it for functions only works with a subset of functions where the number of params is 0 or 1, but not two or more. And while we can use "the" with a subset of built-in functions, we can't with custom functions. Lots of "sometimes" rules were introduced as by-products of that design decision, making the learning curve more steep even as it attempts to lower it. LiveCode has little choice but to follow the established convention, butt when I teach newcomers I never even show them that "the" can sometimes be used for functions. > ...but at the same time it’s kind of a trap within the idea that > LC scripting is “English-like". HyperTalk was once arguably "English-like" back when the alternatives were C and Pascal. When it premiered there were very few scripting languages; among the few in widespread use was bash, which is wonderful but sparse, and thus not very readable. Today, scripting languages have followed Osterhout's prediction from the '90s to become a leading means of developing applications. One of the key goals of any scripting language is to provide readable code. Ruby, and maybe more so Lua, are nearly on par with LiveCode for readability when we compare professionally-written production code. E.g. this: put arrayEncode( the customProperties["Prefs"] of stack "Prefs" ) \ into url ("binfile:"& specialFolderPath("Preferences") & \ "/MyPrefs.dat" ) ...is readable enough, but far from English. What LiveCode brings to the modern world is a high-level scripting language distinguished not by any conformance to the rules of English, but by being among the very few that include support for GUI controls as inherent language elements. With LiveCode, that occurs across a platform coverage that I don't believe any other scripting language with integrated GUI support offers. -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ 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: The selectedObjects - is it a container or not?
Yes, thanks very much Mark. I do get it completely now, if a little belatedly! Cheers Graham > On 19 Apr 2017, at 09:15, Mark Waddingham via use-livecode >wrote: > > Hi Graham, > > On 2017-04-17 21:07, Graham Samuel via use-livecode wrote: >> I have a stack where the user is allowed to select vector objects. For >> this example, let’s assume some objects are already selected. >> I am using LC 8.1.4 rc1 on a Mac running Sierra, and I have a bit of >> code that says in part: >>if the selectedObjects is not empty then >> repeat with i = 1 to the number of lines of the selectedObjects >> … > > Just to clear up precisely what is going on here... > > There are a number of pieces of syntax in LiveCode which return control > references (e.g. field 1). As LiveCode represents such things as strings > there is an ambiguity when you do: > > of > > e.g. the number of lines of the selectedObject > > In this case it could either mean: > > 1) the number of lines in the string returned by the selectedObject > > 2) the number of lines in the control returned by the selectedObject > > The engine tends towards case (2) in most cases (I can't say all cases > without going through all such things and checking) - including this one. > >> OTOH, if I change the second line to >> repeat with i = 1 to the number of lines of (the selectedObjects0 >> the code works as expected. > > The presence of brackets here force evaluation of 'the selectedObjects' > as a string and not as a control. > >> If I execute in the message box: >> put the number of lines of the selectedObjects >> I sometimes get no result and sometimes “source is not a container”, >> but if I change the line to: >>put the number of lines of (the selectedObjects) >> I always get the right answer. > > In the first case, whether or not 'the number of lines of the selectedObjects' > will do something sensible depends on: > > 1) if there is a selectedObject (otherwise you are trying to get the > number of lines in no object - which makes no sense) > > 2) There is a selected object, but it has no idea of a 'text' property > so doesn't have anything for 'the number of lines of' to process. > > Hope this helps! > > Mark. > > -- > Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/ > LiveCode: Everyone can create apps > > ___ > 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: The selectedObjects - is it a container or not?
Hi Graham, On 2017-04-17 21:07, Graham Samuel via use-livecode wrote: I have a stack where the user is allowed to select vector objects. For this example, let’s assume some objects are already selected. I am using LC 8.1.4 rc1 on a Mac running Sierra, and I have a bit of code that says in part: if the selectedObjects is not empty then repeat with i = 1 to the number of lines of the selectedObjects … Just to clear up precisely what is going on here... There are a number of pieces of syntax in LiveCode which return control references (e.g. field 1). As LiveCode represents such things as strings there is an ambiguity when you do: of e.g. the number of lines of the selectedObject In this case it could either mean: 1) the number of lines in the string returned by the selectedObject 2) the number of lines in the control returned by the selectedObject The engine tends towards case (2) in most cases (I can't say all cases without going through all such things and checking) - including this one. OTOH, if I change the second line to repeat with i = 1 to the number of lines of (the selectedObjects0 the code works as expected. The presence of brackets here force evaluation of 'the selectedObjects' as a string and not as a control. If I execute in the message box: put the number of lines of the selectedObjects I sometimes get no result and sometimes “source is not a container”, but if I change the line to: put the number of lines of (the selectedObjects) I always get the right answer. In the first case, whether or not 'the number of lines of the selectedObjects' will do something sensible depends on: 1) if there is a selectedObject (otherwise you are trying to get the number of lines in no object - which makes no sense) 2) There is a selected object, but it has no idea of a 'text' property so doesn't have anything for 'the number of lines of' to process. Hope this helps! Mark. -- Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/ LiveCode: Everyone can create apps ___ 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: The selectedObjects - is it a container or not?
She used to be wrong, but she used her Time Travel stack to go back and correct everything. Bob S On Apr 18, 2017, at 24:46 , Graham Samuel via use-livecode> wrote: Jacque, you’re never wrong! ___ 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: The selectedObjects - is it a container or not?
Jacque, you’re never wrong! I know really that the ‘the’ indicates a function, but at the same time it’s kind of a trap within the idea that LC scripting is “English-like". For clarity, managing the selected objects is probably better done by something like: put selectedObjects() into temp then do stuff with ‘temp’, which of course **is** a container. Anyway thanks Graham > On 18 Apr 2017, at 01:39, J. Landman Gay via use-livecode >wrote: > >> I have a bit of code that says in part: >> >>if the selectedObjects is not empty then >> repeat with i = 1 to the number of lines of the selectedObjects >> … >> >> This results in an error “source is not a container”. >> >> OTOH, if I change the second line to >> >> repeat with i = 1 to the number of lines of (the selectedObjects0 >> >> the code works as expected. > > > The selectedObjects is a function that returns a text list. It isn't a > container. Adding parentheses forces the engine to evaluate the function and > use its return value, which does have lines in it. > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > ___ 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: The selectedObjects - is it a container or not?
I have a bit of code that says in part: if the selectedObjects is not empty then repeat with i = 1 to the number of lines of the selectedObjects … This results in an error “source is not a container”. OTOH, if I change the second line to repeat with i = 1 to the number of lines of (the selectedObjects0 the code works as expected. The selectedObjects is a function that returns a text list. It isn't a container. Adding parentheses forces the engine to evaluate the function and use its return value, which does have lines in it. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ 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: The selectedObjects - is it a container or not?
Hi. If I have three buttons on a card, named "b1", "b2" and "b3", and in the script of "b3" I have: on mouseUp select btn "b1" and btn "b2" answer the selectedObjects end mouseUp I get both selected buttons without issue.. Note this is in v. 6.7.9. But the "selectedObjects" does not seem to stick very long. Consider these two handlers: on mouseUp select btn "b1" and btn "b2" repeat with y = 1 to the number of lines of the selectedObjects put word 1 of line y of the selectedObjects into line y of gg end repeat answer gg end mouseUp on mouseUp select btn "b1" and btn "b2" put the selectedObjects into ff repeat with y = 1 to the number of lines of ff put word 1 of line y of the selectedObjects into line y of gg end repeat answer gg end mouseUp The second one keeps the result of the function. The first one does not. Craig Newman -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/The-selectedObjects-is-it-a-container-or-not-tp4714040p4714042.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ 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