Re: Some thoughts on duck typing

2011-01-17 Thread David Bovill
Thierry - would be good to understand a bit more. It looks like I've done the same sort of thing - defined a meta structure for Livecode objects, and for the same sort of reasons. However I "think" you've mapped them to a more robust model, while I've more or less duplicated the existing LiveCode s

Re: Some thoughts on duck typing

2011-01-17 Thread Thierry
Le 14 janv. 2011 à 03:48, Mark Wieder a écrit : > Richard- > > Thursday, January 13, 2011, 8:02:16 AM, you wrote: > >> How did you do that for any objects other than images? > > It can be done, but it's *really* ugly. Determine the ID you want to > create (it's best to create a numerically-sor

Re: Some thoughts on duck typing

2011-01-17 Thread Thierry
Le 13 janv. 2011 à 17:02, Richard Gaskin a écrit : > How did you do that for any objects other than images? Hi Richard, Well, it's a big topic. :) First, I used this approach in all my *industrial* projects, as BioArchimed for instance - can see it on my web pages. For the sake of the story,

Re: Some thoughts on duck typing

2011-01-13 Thread Mark Wieder
Richard- Thursday, January 13, 2011, 8:02:16 AM, you wrote: > How did you do that for any objects other than images? It can be done, but it's *really* ugly. Determine the ID you want to create (it's best to create a numerically-sorted list if you're doing more than one), then start creating and

Re: Some thoughts on duck typing

2011-01-13 Thread Alejandro Tejada
ore them for faster access) Probably there was more, but these are the features that I remember well. Alejandro -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Some-thoughts-on-duck-typing-tp3213779p3216692.html Sent from the Revolution - User mailing list arch

Re: Some thoughts on duck typing

2011-01-13 Thread Richard Gaskin
Thierry wrote: Le 13 janv. 2011 à 16:01, Andre Garzia a écrit : till late 4.5.x we could not set ids for all objects by hand. ... That prevented textual representation of stacks because the restore operation would have different ids assigned by the engine which you could not change. Now you c

Re: Some thoughts on duck typing

2011-01-13 Thread Thierry
Le 13 janv. 2011 à 16:01, Andre Garzia a écrit : > till late 4.5.x we could not set ids for all objects by hand. Thanks Andre, I missed this new information... Great ! > That prevented textual representation of stacks because the restore > operation would have different ids assigned by the en

Re: Some thoughts on duck typing

2011-01-13 Thread Andre Garzia
On Thu, Jan 13, 2011 at 10:59 AM, Thierry wrote: > > Le 13 janv. 2011 à 13:19, David Bovill a écrit : > > > Hi David, > >> With recent changes to to engine >> so that you can set id properties of objects full text based stack >> representations are possible. > > ? > > Would be nice if you can elab

Re: Some thoughts on duck typing

2011-01-13 Thread Thierry
Le 13 janv. 2011 à 13:19, David Bovill a écrit : Hi David, > With recent changes to to engine > so that you can set id properties of objects full text based stack > representations are possible. ? Would be nice if you can elaborate this one, I can't follow you... Since when it was not possibl

Re: Some thoughts on duck typing

2011-01-13 Thread David Bovill
On 13 January 2011 01:29, Alejandro Tejada wrote: > > Recently, in other messages, you mentioned > saving stacks as xml and using "git", the > distributed revision control system. > Now, this thread is about data type checking. > > Are you developing stacks as xml text files > and using Livecode

Re: Some thoughts on duck typing

2011-01-12 Thread Alejandro Tejada
Alejandro -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Some-thoughts-on-duck-typing-tp3213779p3215086.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list us

Re: Some thoughts on duck typing

2011-01-12 Thread Peter W A Wood
On 13 Jan 2011, at 01:55, Jeff Massung wrote: > - Next, determine text vs. binary. This is usually done by just grabbing the > first N (where N is ~1000) bytes and look for any that are < 10 or > 127. If > you find any, it's binary - or unicode. This is only true if the text is 7-bit encoded whi

Re: Some thoughts on duck typing

2011-01-12 Thread David Bovill
On 12 January 2011 14:37, Richard Gaskin wrote: > If such metadata are needed for the variables, what would be the downside > of using an array? That way you could store/access the type metadata > quickly: > > put tData into gMyDucksA["label"]["data"] > put "rtfText" into gMyDucksA["label"]["t

Re: Some thoughts on duck typing

2011-01-12 Thread David Bovill
It does Jeff - thanks lots of detail there to translate into good 'ol code :) On 12 January 2011 17:55, Jeff Massung wrote: > On Wed, Jan 12, 2011 at 4:37 AM, David Bovill >wrote: > > > If it quacks like a duck it is a duck. > > > > So I have some data in a variable that I want to display. I ca

Re: Some thoughts on duck typing

2011-01-12 Thread Jerry J
On Jan 12, 2011, at 4:26 AM, Andre Garzia wrote: > I do extreme duck typing, which is: "Can I make it quack?", so what I do is > try exclusive > operations on the variable, if the operation succeeds, then it is a duck. "Quack, damn you!" --Jamie Hyneman, Mythbuster __

Re: Some thoughts on duck typing

2011-01-12 Thread Jeff Massung
On Wed, Jan 12, 2011 at 4:37 AM, David Bovill wrote: > If it quacks like a duck it is a duck. > > So I have some data in a variable that I want to display. I can use is an > array/number/date - but for other types of data I'm wandering... xml should > be easy, but harder would be to distinguish lo

Re: Some thoughts on duck typing

2011-01-12 Thread Bob Sneidar
That's what all the dead duck thought just before that "big bang". Bob On Jan 12, 2011, at 3:37 AM, David Bovill wrote: > If it quacks like a duck it is a duck. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to su

Re: Some thoughts on duck typing

2011-01-12 Thread Richard Gaskin
David Bovill wrote: If it quacks like a duck it is a duck. So I have some data in a variable that I want to display. I can use is an array/number/date - but for other types of data I'm wandering... xml should be easy, but harder would be to distinguish long text files from binary. Any ideas for

Re: Some thoughts on duck typing

2011-01-12 Thread David Bovill
Ducks - are my big thing this year. I think they are going to be big. On 12 January 2011 13:07, Andre Garzia wrote: > On Wed, Jan 12, 2011 at 10:57 AM, william humphrey < > b...@bluewatermaritime.com> wrote: > > > Except that "extreme duck typing" sounds like something you would need to > > dres

Re: Some thoughts on duck typing

2011-01-12 Thread Andre Garzia
On Wed, Jan 12, 2011 at 10:57 AM, william humphrey < b...@bluewatermaritime.com> wrote: > Except that "extreme duck typing" sounds like something you would need to > dress in camouflage clothing first and maybe build a blind. > camouflage is useless in extreme duck typing, it may not look like a

Re: Some thoughts on duck typing

2011-01-12 Thread william humphrey
Except that "extreme duck typing" sounds like something you would need to dress in camouflage clothing first and maybe build a blind. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage yo

Re: Some thoughts on duck typing

2011-01-12 Thread Andre Garzia
David, Be aware that this type inference will cost you cpu and degrade performance if used constantly in the code like thousand steps in a loop. If it is a variable which you control all the lifecycle, then you could attach metadata to it and thus be able to create a little type system which I thi

Some thoughts on duck typing

2011-01-12 Thread David Bovill
If it quacks like a duck it is a duck. So I have some data in a variable that I want to display. I can use is an array/number/date - but for other types of data I'm wandering... xml should be easy, but harder would be to distinguish long text files from binary. Any ideas for hacks to distinguish: