Re: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread hh via use-livecode
> Richard H. wrote:
> I'm also bothered by *not* being able to use a text literal in quotes;
> I'm generally vary careful about declared variables, etc. (I'd really
> like an option to enforce case in variable names!)

on mouseUp
  put "hello" into p1
  put quote&"hello" into p2
  set the p1 of me to "new1"
  set the p2 of me to "new2"
  put the p1 of me && the p2 of me
end mouseUp

This works here as it should.
The keys become "hello" (incl.quotes) and hello (without quotes).

What do I not understand in your statement above?
What do you mean by "use a text literal in quotes"?

___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Dr. Hawkins via use-livecode
On Tue, Aug 8, 2017 at 8:56 AM, Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

>
> Years ago I knew a woman who wanted to use special characters on her mac
> for file names which were perfectly legal with HFS, but NOT legal for NTFS.
> When we moved her files to a Windows share, some of her files, though
> visible, were inaccessible. (Why Windows even allowed the files to be
> written without some kind of warning is another mystery).
>

There is a long and tragic history of OSs allowing applications and calls
to create illegal file names . . .

My first (but not last) was discovering that CP/M would let MBASIC create a
file with a lower case name, even though CP/M was uppercase.  I want to say
that it displayed as uppercase in CP/M, too.  I think I ended up with two
files with the same name . . .

The *ONLY* punctuation I allow in file names are dot and underbar, and this
is enforced upon staff.   There aren't many others, if any, that have
meaning in *some* OS or another . . .
-- 
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Dr. Hawkins via use-livecode
On Tue, Aug 8, 2017 at 8:33 AM, Mark Waddingham via use-livecode <
use-livecode@lists.runrev.com> wrote:

> On 2017-08-08 17:25, J. Landman Gay via use-livecode wrote:
>
>> The answer to the first case is "don't do that". Use a different
>> variable name for the local.
>>
>
> Well, yes, that is certainly one way to look at it!
>

The catch is that this isn't something that I stumbled across while
initially developing.  It took a couple of years for things coming from two
different directions, each consistent in their own right, to collide like
this.

I see it as more of a maintenance issue than a development issue (but, then
that's where I was bit).

I'm also bothered by *not* being able to use a text literal in quotes; I'm
generally vary careful about declared variables, etc. (I'd really like an
option to enforce case in variable names!)

-- 
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Wieder via use-livecode

On 08/08/2017 08:56 AM, Bob Sneidar via use-livecode wrote:

Again, don't do that.

Years ago I knew a woman who wanted to use special characters on her mac for 
file names which were perfectly legal with HFS, but NOT legal for NTFS. When we 
moved her files to a Windows share, some of her files, though visible, were 
inaccessible. (Why Windows even allowed the files to be written without some 
kind of warning is another mystery).


Heh.
Once on a Windows machine I ended up with a filename that had a trailing 
space. Nothing would get rid of it. Nothing. Every disk utility I tried 
found the file with no problem, but deleting the file failed because the 
trailing space wasn't recognized by the OS. The File-That-Wouldn't-Die 
lived on until the disk was reformatted.


--
 Mark Wieder
 ahsoftw...@gmail.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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-08 17:59, Mark Wieder via use-livecode wrote:

On 08/08/2017 08:49 AM, hh via use-livecode wrote:

JLG wrote:
In what circumstance would it be necessary to quote the property 
name?


Use "&" in a key, for example the "G" of me


Is there any use case where punctuation in a property name is a good 
idea?


Is there any use case where punctuation in a variable name is a good 
idea? ;)


As a custom property set is an unconstrained array; you can actually 
have custom properties which have any string as key (set via the 
customProperties property) - so it is entirely possible to create such 
things. Whether you should or not is another matter, but that's true of 
lots of things in LiveCode (and many programming languages in general).


The main issue here (I think) is the inconsistency in evaluation of 
quoted literals - it means that you can't say


"A quoted literal always evaluates to the quoted value"

Instead you have to say:

"In all but the case of using the indirect form of setting a custom 
property, a quoted literal will evaluate to the quoted value"


Having simple rules which are applicable in all cases both makes things 
easier to learn, and harder to make mistakes (because you don't trip 
yourself up on unique inconsistencies which you may have never known, or 
have forgotten).


Warmest Regards,

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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Bob Sneidar via use-livecode
I agree here with Mark that this is an oversight, an aberration. It should't 
work the way it presently does, and I would not count on it being this way 
forever. Some other issue may arise in the future requiring someone to "fix 
this" and your code will break. 

Swim away from the other fish if you like, but beware of the sharks lurking 
about. 

Bob S


> On Aug 8, 2017, at 09:00 , Mark Waddingham via use-livecode 
>  wrote:
> 
> Perhaps I'm misunderstanding your point here, but I think array syntax 
> actually helps justify why the current behavior is wrong. Compare:
> 
> put 100 into redvalue
> put 0 into myArray[redvalue]
> put 255 into myArray["redvalue"]
> 
> To:
> 
> put 100 into redvalue
> set the redvalue of me to 0
> set the "redvalue" of me to 255
> 
> In the first case you get an array { 100: 0, redvalue: 255 }.
> 
> In the second case the customprops array is { 100: 255 }.
> 
> Basically everywhere else quoted literals evaluate to the quoted value - 
> unquoted literals might evaluate to the contents of a variable if that 
> variable has been created. In this case (in 'the ... of ...'), though, the 
> quoted literal gets treated as if it doesn't have quotes all the time.
> 
> Warmest Regards,
> 
> 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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-08 17:49, hh via use-livecode wrote:

From a viewpoint of the "get property /set property" syntax
"unexpected results" sounds convincing here, but, TMHO, it is
exactly what I would expect from a **viewpoint of array syntax**.

on mouseUp
  local catness
  put "minimal" into catness
  --> Then the next two lines
  set the minimal of me to "very much"--(1)
  set the "minimal" of me to "very much"  --(2)
  --> are equivalent and create the same key "minimal".
  --> As catness is "minimal" and is NOT empty, this is also equivalent 
to

  set the catness of me to "very much"--(3)
  --> what is, as usual when quoting, equivalent to
  set the "catness" of me to "very much"  --(4)
  --> Four equivalent commands (1)-(4) result in the same key 
"minimal".

  --> And it["catness"] is empty, correctly.
  get the customProperties of me
  put it["catness"] &"/"& it[catness] &"/"& it["minimal"] &"/"& 
it[minimal]

  put cr & the keys of it after msg
end mouseUp


Perhaps I'm misunderstanding your point here, but I think array syntax 
actually helps justify why the current behavior is wrong. Compare:


put 100 into redvalue
put 0 into myArray[redvalue]
put 255 into myArray["redvalue"]

To:

put 100 into redvalue
set the redvalue of me to 0
set the "redvalue" of me to 255

In the first case you get an array { 100: 0, redvalue: 255 }.

In the second case the customprops array is { 100: 255 }.

Basically everywhere else quoted literals evaluate to the quoted value - 
unquoted literals might evaluate to the contents of a variable if that 
variable has been created. In this case (in 'the ... of ...'), though, 
the quoted literal gets treated as if it doesn't have quotes all the 
time.


Warmest Regards,

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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Wieder via use-livecode

On 08/08/2017 08:49 AM, hh via use-livecode wrote:

JLG wrote:
In what circumstance would it be necessary to quote the property name?


Use "&" in a key, for example the "G" of me


Is there any use case where punctuation in a property name is a good idea?

--
 Mark Wieder
 ahsoftw...@gmail.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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Bob Sneidar via use-livecode
Again, don't do that. 

Years ago I knew a woman who wanted to use special characters on her mac for 
file names which were perfectly legal with HFS, but NOT legal for NTFS. When we 
moved her files to a Windows share, some of her files, though visible, were 
inaccessible. (Why Windows even allowed the files to be written without some 
kind of warning is another mystery). 

So I tried to tell her to only use letters, numbers, spaces (if she had to), 
dashes and underscores. She would not listen. She insisted on naming files her 
own special way and would not change, but still wanted me to "make it work". 


Bob S


> On Aug 8, 2017, at 08:49 , hh via use-livecode 
>  wrote:
> 
>> JLG wrote:
>> In what circumstance would it be necessary to quote the property name?
> 
> Use "&" in a key, for example the "G" of me


___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-08 17:46, Bob Sneidar via use-livecode wrote:

famous last words. :-)


Indeed - perhaps a slight case of over-optimism on my part...

:'(

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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread hh via use-livecode
> JLG wrote:
> In what circumstance would it be necessary to quote the property name?

Use "&" in a key, for example the "G" of me

> Mark wrote:
> What doesn't work at the moment is if you have a var name which is 
> quoted:
> 
> local catness
> put "minimal" into catness
> set the "catness" of me to "very much"
> get the customProperties of me
> put the keys of it
> 
> Will result in a key 'minimal' and *not* 'catness' - which is perhaps 
> not what would be expected.

>From a viewpoint of the "get property /set property" syntax
"unexpected results" sounds convincing here, but, TMHO, it is
exactly what I would expect from a **viewpoint of array syntax**.

on mouseUp
  local catness
  put "minimal" into catness
  --> Then the next two lines
  set the minimal of me to "very much"--(1)
  set the "minimal" of me to "very much"  --(2)
  --> are equivalent and create the same key "minimal".
  --> As catness is "minimal" and is NOT empty, this is also equivalent to
  set the catness of me to "very much"--(3)
  --> what is, as usual when quoting, equivalent to
  set the "catness" of me to "very much"  --(4)
  --> Four equivalent commands (1)-(4) result in the same key "minimal".
  --> And it["catness"] is empty, correctly.
  get the customProperties of me
  put it["catness"] &"/"& it[catness] &"/"& it["minimal"] &"/"& it[minimal]
  put cr & the keys of it after msg
end mouseUp



___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Bob Sneidar via use-livecode
famous last words. :-)

Bob S


> On Aug 8, 2017, at 08:15 , Mark Waddingham via use-livecode 
>  wrote:
> 
> I think the latter is probably something which is unlikely to hurt anyone if
> tweaked though...
> 
> Warmest Regards,
> 
> Mark.
> 


___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-08 17:33, Mark Waddingham via use-livecode wrote:

(Of course, I'm now going to go off and see if you can use quoted
variables in other places - I bet that's going to a 50/50 chance in 
every

place!)


Okay - so:

  the  of ...

Is the *only* place where a check to make sure something is an unquoted
literal before looking up a var *is not* done... So I think this was 
probably

*not* intended and is a mistake. i.e.

  the "foobar" of ...

Should actually throw an error at the moment!

Warmest Regards,

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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-08 17:25, J. Landman Gay via use-livecode wrote:

The answer to the first case is "don't do that". Use a different
variable name for the local.


Well, yes, that is certainly one way to look at it!

However, *usually* quotes are used to ensure something is treated as
the literal value so my general feeling (since quoted property names
only work in some situations) is that this is actually an error, and was
never intended. Indeed, it comes down to *not* checking whether 
something

is an IDENTIFIER or a STRING in the parsing code before looking up a
variable.

(Of course, I'm now going to go off and see if you can use quoted
variables in other places - I bet that's going to a 50/50 chance in 
every

place!)


The second case is interesting. I wouldn't mind having multiple-word
property names.


Its not just that - it allows you to not have to use variable 
indirection

if your property names aren't identifiers too.

Of course, if were all good pandas we'd probably try and avoid using 
anything
other than (single) identifiers and were never the same as any local, 
script local

or global variable name...

Warmest Regards,

Mark.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com



On August 8, 2017 10:17:29 AM Mark Waddingham via use-livecode
 wrote:


On 2017-08-08 17:09, J. Landman Gay via use-livecode wrote:
In what circumstance would it be necessary to quote the property 
name?


The original case Dr Hawkins encountered was something along the lines
of:

local someVar
put 100 into someVar
put the someVar of me

Here, this will fetch the custom property '100'. Ideally you'd be able
to do

   put the "someVar" of me

Instead - the quoting indicating you want to use that *literal* value
for the
property name, instead of the variables context.

Another case is wanting to fetch custom property names which contain
chars you
can't have in an unquoted literal:

   put the "my property name with lots of words (and parantheses) too" 
of

me

Currently, using quoted literals in this case works for setting, but
doesn't
work for getting; and even a quoted literal will still resolve to a
variable
if one has been defined.

I think the latter is probably something which is unlikely to hurt
anyone if
tweaked though...

Warmest Regards,

Mark.



On August 8, 2017 6:05:21 AM Mark Waddingham via use-livecode
 wrote:


What doesn't work at the moment is if you have a var name which is
quoted:

   local catness
   put "minimal" into catness
   set the "catness" of me to "very much"
   get the customProperties of me
   put the keys of it

Will result in a key 'minimal' and *not* 'catness' - which is 
perhaps

not what would be expected.


--
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


--
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


--
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread J. Landman Gay via use-livecode
The answer to the first case is "don't do that". Use a different variable 
name for the local.


The second case is interesting. I wouldn't mind having multiple-word 
property names.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com



On August 8, 2017 10:17:29 AM Mark Waddingham via use-livecode 
 wrote:



On 2017-08-08 17:09, J. Landman Gay via use-livecode wrote:

In what circumstance would it be necessary to quote the property name?


The original case Dr Hawkins encountered was something along the lines
of:

local someVar
put 100 into someVar
put the someVar of me

Here, this will fetch the custom property '100'. Ideally you'd be able
to do

   put the "someVar" of me

Instead - the quoting indicating you want to use that *literal* value
for the
property name, instead of the variables context.

Another case is wanting to fetch custom property names which contain
chars you
can't have in an unquoted literal:

   put the "my property name with lots of words (and parantheses) too" of
me

Currently, using quoted literals in this case works for setting, but
doesn't
work for getting; and even a quoted literal will still resolve to a
variable
if one has been defined.

I think the latter is probably something which is unlikely to hurt
anyone if
tweaked though...

Warmest Regards,

Mark.



On August 8, 2017 6:05:21 AM Mark Waddingham via use-livecode
 wrote:


What doesn't work at the moment is if you have a var name which is
quoted:

   local catness
   put "minimal" into catness
   set the "catness" of me to "very much"
   get the customProperties of me
   put the keys of it

Will result in a key 'minimal' and *not* 'catness' - which is perhaps
not what would be expected.


--
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


--
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-08 17:09, J. Landman Gay via use-livecode wrote:

In what circumstance would it be necessary to quote the property name?


The original case Dr Hawkins encountered was something along the lines 
of:


local someVar
put 100 into someVar
put the someVar of me

Here, this will fetch the custom property '100'. Ideally you'd be able 
to do


  put the "someVar" of me

Instead - the quoting indicating you want to use that *literal* value 
for the

property name, instead of the variables context.

Another case is wanting to fetch custom property names which contain 
chars you

can't have in an unquoted literal:

  put the "my property name with lots of words (and parantheses) too" of 
me


Currently, using quoted literals in this case works for setting, but 
doesn't
work for getting; and even a quoted literal will still resolve to a 
variable

if one has been defined.

I think the latter is probably something which is unlikely to hurt 
anyone if

tweaked though...

Warmest Regards,

Mark.



On August 8, 2017 6:05:21 AM Mark Waddingham via use-livecode
 wrote:


What doesn't work at the moment is if you have a var name which is
quoted:

   local catness
   put "minimal" into catness
   set the "catness" of me to "very much"
   get the customProperties of me
   put the keys of it

Will result in a key 'minimal' and *not* 'catness' - which is perhaps
not what would be expected.


--
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


--
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread J. Landman Gay via use-livecode

In what circumstance would it be necessary to quote the property name?


On August 8, 2017 6:05:21 AM Mark Waddingham via use-livecode 
 wrote:



What doesn't work at the moment is if you have a var name which is
quoted:

   local catness
   put "minimal" into catness
   set the "catness" of me to "very much"
   get the customProperties of me
   put the keys of it

Will result in a key 'minimal' and *not* 'catness' - which is perhaps
not what would be expected.


--
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-08 12:43, hh via use-livecode wrote:

Two examples for testing ambiguity.

[a]
  set "8.1" of me to "I dreamt to be quoted"
  set 8.1 of me to "I dreamt to be 8.2"
  put the customProperties of me into cp
  put cp["8.1"] &" : "& cp[8.1] &" : "& cp[8+1/10]
Test and then interchange the first two lines and test again.

[b]
  set "G" of me to "I dreamt to be geometry and trigonometry"
  put the customProperties of me into cp
  put cp["G"]


So this does work as 'expected' currently. i.e. You can use a quoted or 
unquoted literal for a custom property name, and it will use the literal 
appropriately.


What doesn't work at the moment is if you have a var name which is 
quoted:


  local catness
  put "minimal" into catness
  set the "catness" of me to "very much"
  get the customProperties of me
  put the keys of it

Will result in a key 'minimal' and *not* 'catness' - which is perhaps 
not what would be expected.


Warmest Regards,

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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread hh via use-livecode
Two examples for testing ambiguity.

[a]
  set "8.1" of me to "I dreamt to be quoted"
  set 8.1 of me to "I dreamt to be 8.2"
  put the customProperties of me into cp
  put cp["8.1"] &" : "& cp[8.1] &" : "& cp[8+1/10]
Test and then interchange the first two lines and test again.

[b]
  set "G" of me to "I dreamt to be geometry and trigonometry"
  put the customProperties of me into cp
  put cp["G"]


___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-08 Thread Mark Waddingham via use-livecode

On 2017-08-03 05:39, Monte Goulding via use-livecode wrote:

Er… why if you know the name wouldn’t you type it unquoted? Are you
really suggesting to put any expression there? The property/function
ambiguity with `the` will make our heads explode!


For the reason Dr Hawkins originally asked about ;)

There is no ambiguity if we have:

   1. 'the' IDENTIFIER 'of' ...
   2. 'the' STRING 'of' ...
   3. 'the' '(' EXPRESSION ')' 'of' ...

The key thing about making property syntax more flexible (e.g. multiple 
words - unquoted) is to enforce 'the' and 'of' - indeed, if you use a 
custom (non engine keyword) name of any kind then both are required so 
that's good :)


In any case, I got around to looking at it this morning and case (2) 
almost works already. Doing:


  set the "catness" of this stack to "very"

  put the customKeys of this stack

  put the "catness" of this stack

Results in a catness (no quotes) key in the stack's custom properties, 
but an execution error (source is not a container) when evaluating it.


Warmest Regards,

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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-03 Thread Bob Sneidar via use-livecode
If the handler is in the same script as the constant, why would you? A constant 
is for representing values that do not change after compile. Variables are for 
values that change during runtime. I cannot imagine a use case for putting a 
constant name into a variable, although I have thought about the need to get 
the constant from another script, until I remembered it's just easier to set a 
custom property. 

In fact (I think I've said so before) custom props are a great way to mimic 
scoped variables, and even constants. For instance all my datagrids have a 
property tablename containing the name of the table I query to populate it. 

Bob S


> On Aug 2, 2017, at 10:20 , Matthias Rebbe via use-livecode 
>  wrote:
> 
> Hi,
> 
> let´s say a card has a custom property name cMyProp.
> 
> The variable tMyVar contains the word “cMyProp”
> 
> How do i get the value of the custom property using the variable tMyVar?
> 
> Regards,
> Matthias
> 
> 
> 
> Matthias Rebbe

___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-03 Thread Dr. Hawkins via use-livecode
On Wed, Aug 2, 2017 at 8:39 PM, Monte Goulding via use-livecode <
use-livecode@lists.runrev.com> wrote:

>
> Er… why if you know the name wouldn’t you type it unquoted? Are you really
> suggesting to put any expression there? The property/function ambiguity
> with `the` will make our heads explode!
>

If I have a variable "propertyZ", then under current code I *cannot* use

   set the propertyZ of theThing to 7

to affect the custom property named propertyZ.  Allowing quotes would solve
this.

In my case, I hit this in a "metaprocedure" that runs in development to
enforce consistency, find variable fields, and whathaveyou, and separately
came to the same "natural" name for both a variable and a customproperty,
leading to significant debugging until I figured out why it wasn't working.



-- 
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Monte Goulding via use-livecode

> On 3 Aug 2017, at 7:36 am, Mark Waddingham via use-livecode 
>  wrote:
> 
> Of course, if you'd like to file a bug report / enhancement about being able 
> to do 'the "mycustompropname" of ... - then that is probably the 'future' 
> much better solution :)

Er… why if you know the name wouldn’t you type it unquoted? Are you really 
suggesting to put any expression there? The property/function ambiguity with 
`the` will make our heads explode!

Cheers

Monte
___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Paul Hibbert via use-livecode
> 
> let´s say a card has a custom property name cMyProp.
> 
> The variable tMyVar contains the word “cMyProp”
> 
> How do i get the value of the custom property using the variable tMyVar?

Using the “do” command, a quick test and this works OK:

on mouseUp
put "cMyProp" into tMyVar

do "put the" && tMyVar && "of this card into fld 1"

end mouseUp


Paul
___
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Dr. Hawkins via use-livecode
On Wed, Aug 2, 2017 at 2:36 PM, Mark Waddingham via use-livecode <
use-livecode@lists.runrev.com> wrote:

> You can put the name of the property into a local var and use that (unless
> I misunderstood the problem).
>

That's what I do

>
>
> Of course, if you'd like to file a bug report / enhancement about being
> able to do 'the "mycustompropname" of ... - then that is probably the
> 'future' much better solution :


I've given thought to that on and off--but I don't see a way thats both
consistent with specifying a text string, and with the usage for other
objects.

Oh, wait; now I remember:  allow the use of quoted text in the property
reference.  At the moment,

the "catness" of control "dog"

refers not to the catness property, but to a property whose name begins
with a quote.  I think that *this* is an inconsistency and a bug.

OK, filed as *Bug 20228* 
 - quotes taken as literal rather than as a delimiter when referring to
custom properties
-- 
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Mark Waddingham via use-livecode
You can put the name of the property into a local var and use that (unless I 
misunderstood the problem).

Ali's suggestion is however the very pragmatic one - there are always going to 
be cases where var names might conflict with other things 'in context' and 
require disambiguation. (Although even that doesn't work in some cases - 
consider 'tExt' - when you have case insensitivity and no need to explicitly 
declare variables).

Of course, if you'd like to file a bug report / enhancement about being able to 
do 'the "mycustompropname" of ... - then that is probably the 'future' much 
better solution :)

Warmest Regards,

Mark.

Sent from my iPhone

> On 2 Aug 2017, at 21:56, Dr. Hawkins via use-livecode 
>  wrote:
> 
> On Wed, Aug 2, 2017 at 10:25 AM, Klaus major-k via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> 
>> 
>> answer the tMyVar of this cd
>> 
> 
> This is an area that is awkward in live code.
> 
> The use of unquoted literals for this is inconsistent with most of live
> code (but quoting would be inconsistent with the built in properties, so .
> . .)
> 
> I have "loops" like
> 
> repeat for each word someProp in "theOnlyPropInTheList"
> 
> set the someProp of someControl to myVal
> 
> end repeat
> 
> 
> If you have a variable whose name is the same as the property, there does
> does not seem to be a good solution.
> -- 
> 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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Ali Lloyd via use-livecode
A good reason to use consistent prefixes to distinguish custom props and
variables perhaps.
On Wed, 2 Aug 2017 at 20:56, Dr. Hawkins via use-livecode <
use-livecode@lists.runrev.com> wrote:

> On Wed, Aug 2, 2017 at 10:25 AM, Klaus major-k via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
> >
> > answer the tMyVar of this cd
> >
>
> This is an area that is awkward in live code.
>
> The use of unquoted literals for this is inconsistent with most of live
> code (but quoting would be inconsistent with the built in properties, so .
> . .)
>
> I have "loops" like
>
> repeat for each word someProp in "theOnlyPropInTheList"
>
> set the someProp of someControl to myVal
>
> end repeat
>
>
> If you have a variable whose name is the same as the property, there does
> does not seem to be a good solution.
> --
> 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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Dr. Hawkins via use-livecode
On Wed, Aug 2, 2017 at 10:25 AM, Klaus major-k via use-livecode <
use-livecode@lists.runrev.com> wrote:

>
> answer the tMyVar of this cd
>

This is an area that is awkward in live code.

The use of unquoted literals for this is inconsistent with most of live
code (but quoting would be inconsistent with the built in properties, so .
. .)

I have "loops" like

repeat for each word someProp in "theOnlyPropInTheList"

set the someProp of someControl to myVal

end repeat


If you have a variable whose name is the same as the property, there does
does not seem to be a good solution.
-- 
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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Matthias Rebbe via use-livecode
Thanks Klaus

Tried your  suggestion already before posting, but that did not work. Therefore 
I thought i have to use value or so.

But i just had a “little” error in my script. I should check my code twice 
before asking.

Thanks again.

Matthias





Matthias Rebbe
+49 5741 31
‌matthiasrebbe.eu ‌

> Am 02.08.2017 um 19:25 schrieb Klaus major-k via use-livecode 
> >:
> 
> Hi Matthias,
> 
>> Am 02.08.2017 um 19:20 schrieb Matthias Rebbe via use-livecode 
>> >:
>> 
>> Hi,
>> 
>> let´s say a card has a custom property name cMyProp.
>> The variable tMyVar contains the word “cMyProp”
>> How do i get the value of the custom property using the variable tMyVar?
> 
> ...
> answer the tMyVar of this cd
> ...
> :-)
> 
>> Regards,
>> Matthias
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> http://www.major-k.de 
> kl...@major-k.de
> 
> 
> ___
> 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: how to get the value of a custom property if the name of the cProperty is in a variable?

2017-08-02 Thread Klaus major-k via use-livecode
Hi Matthias,

> Am 02.08.2017 um 19:20 schrieb Matthias Rebbe via use-livecode 
> :
> 
> Hi,
> 
> let´s say a card has a custom property name cMyProp.
> The variable tMyVar contains the word “cMyProp”
> How do i get the value of the custom property using the variable tMyVar?

...
answer the tMyVar of this cd
...
:-)

> Regards,
> Matthias

Best

Klaus

--
Klaus Major
http://www.major-k.de
kl...@major-k.de


___
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