English Like?

Martin Koob mkoob at rogers.com
Wed May 24 11:11:53 EDT 2017


I agree that LiveCode script should become more English like as time goes on
not only with english words but also with more natural(or intuitive)
grammar.

>From your examples I think it would be more natural to type.

   put the third index of tNumericArray into tFoo

OR

    put the backColor of control "foo" into tVarBackColor

(in this example have the engine know it has to get the long id of control
"foo" to access the backColor than for the programmer to remember to assign
it first.)

Often when I am typing a script and I am not sure how to do it I wing it
first to see if what I intuitively write will work.   If that fails then go
to the dictionary or then forums.   

One example is the following.

I wanted a button in a group to access a property of the group so I typed.

   put the width of this group into tWidth.

When I apply that in the script editor it shows no errors but when I run it
it stops with the following error:

 (Chunk: can't find background)

The above line would work if I used card or stack instead of group.  In this
case I had to put.

   put the width of the owner of me into tWidth

So that is grammatically English but not the way I intuitively thought of it
and the sentence is a little unnatural.

I can fake a more natural sentence using a function to hide the way of
accessing the group to get it to read better.

   put the width of this_Group() into tGroupWidth

   function this_Group
      return the owner of me
   end this_Group

It would be nice if this is the direction of the language.

My nickel's* worth.  

* in Canada we ditched the penny a couple of years ago so every purchase is
rounded to the nearest nickel. :-)

Martin


Mark Waddingham via use-livecode wrote
> Of course, LiveCode syntax isn't perfect - it has [] for array access 
> for example - it might be nice to be
> able to do:
> 
>     put index 3 of tNumericArray into tFoo
>     put the foo of tAssocArray into tBar
> 
> Which is perhaps the way I'd suggest the language should go - replacing 
> what we currently use symbols (operators) for with 'English-like' forms.
> 
> It should be noted in all of this that syntax is just sugar (but don't 
> take that as meaning that sugar isn't important - if you forget the 
> sugar in recipes you often end up with inedible things). A handler such 
> as:
> 
>    command Foo
>      put the long id of control "Foo" into tVar
>      put the backColor of tVar into tVarBackColor
>      set the backColor of char 3 to 5 of field 3 to tVarBackColor
>    end Foo
> 
> 
> Just my two pence :)
> 
> Warmest Regards,
> 
> Mark.
> 
> 
> 
> -- 
> Mark Waddingham ~ 

> mark@

>  ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> _______________________________________________
> use-livecode mailing list

> use-livecode at .runrev

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





--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/English-Like-tp4714951p4715152.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list