Re: Rooting around in the Forum: destructors
On 2017-06-03 18:46, Richmond Mathewson via use-livecode wrote: Not having looked at any sort of "serious" programming language since about 1989 (I don't think that VB 6 is a serious language), I find it hard to understand what a destructor is beyond a way to free memory on a system that has constraints in that area. Depends on your definition of 'serious'. I'd say that a language was 'serious' if it allows to write full, complete programs. VB6 certainly did (after all, it had a huge installed user base for a very long time), as was HyperCard, as is LiveCode. 1. Does Livecode have something(s) that does the job of a destructor? Yes. 2. If so, where is it and so on? The 'delete*' messages are destructors for controls. On a more general note this thread descended into a discussion of whether LiveCode is object-oriented or object-based: https://en.wikipedia.org/wiki/Object-oriented_programming https://en.wikipedia.org/wiki/Object-based_language As I've said many times before, object-orientation is a methodology of programming. Any procedural language which has the equivalent of (mutable) structs can be used to program in that style relatively easily. Being 'object-oriented' doesn't mean the language can do any more than any other, just that it allows you to program in that style more easily - with compiler checking via explicit syntax for object-oriented formalisms). LiveCode certainly has the equivalent of structs (assoc. arrays), and mutable parameter modes (@ before a parameter). Which means you can do object-oriented style programming - just as you can in C - indeed I do this a lot: command foobarCreate @xSelf -- init xSelf as an array with the state for foobar end foobarCreate command foobarDoSomething @xSelf -- use state in xSelf array to 'DoSomething' end foobarDoSomething As to whether one calls a language object-oriented or not is largely down to 'what intrinsic features the language gives you to implement the object-oriented methodology'. In particular, an important feature there is to be able to define classes, with some form of inheritence and overriding of methods. Now, since behaviors were introduced (and then chained behaviors), LiveCode has had something which is identical to the fundamental ideas of classes. A behavior script defines a class, the behavior chain allows inheritence, and the message path along that chain gives you inheritence and overriding. So, in that sense, LiveCode is definitely object-oriented. However, one thing (all?) object oriented languages (in the classical sense) allow you to do is to define classes, create instances of those classes and store them in variables - LiveCode doesn't quite have this (LiveCode variables are either numbers/string or arrays), its object-orientation is centered around stacks, cards and controls. (Putting this on a slightly more abstract setting - LiveCode has object-orientation centered around a persistent object-tree, rather than transient object instances). So LiveCode is definitely object-based, but perhaps not quite fully object-oriented in the classical sense - but it is certainly not that far off 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: Rooting around in the Forum: destructors
OOP is driven by the concept of classes and objects, and you cannot think that only means buttons and fields, user interface objects only. OOP means something quite different. Every thing you can refer to in an OOP environment MUST have a parent class. That is what I mean by, "driven". A Class is a definition for an object, a template if you will. You can create a hierarchical system of root classes and child classes that inherit some (or all) of the parent class properties. In fact if you expect to get very far, you *MUST* create that hierarchy before you do any coding. To create an object, you create an instance of a class. In an LC sense it would be like being able to create multiple templates of buttons, fields and menus that looked and acted differently, even for one off objects, and then create instances of them in such a way that if you edited a property of the parent class, say the textfont, all the children/instances of that class would also change. That is the magic of inheritance. But it means that you have to spend an inordinate amount of time planning and structuring you application before you begin creating any of it. Great care to follow good practices is necessary if you intend to go back and modify your class structure. Livecode has no class paradigm per se. You simply create copies of objects that have no backwards inheritance to the "parent" object or class. Indeed there is no parent. LC objects are orphans at birth. I have often though that it might be nice to create an OOP system from the scripting side, but the more I thought about it, the more complex I saw it would have to be. In the end it would be like building the foundation of a tower on top of the tower after the tower had already been built. Bob S > On Jun 3, 2017, at 12:05 , Richmond Mathewson via use-livecode > wrote: > > Thanks for the explanation: although, to be honest I've never really quite > worked out what the > difference is between Object-oriented languages and Object-based languages (I > know that LiveCode is object-based). ___ 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: Rooting around in the Forum: destructors
It's a scripting language. It's not the job of Livecode to do memory management. In fact it's hardly the job of modern apps to do it. The OS manages most of that. For us, the App is the livecode engine, and not our script. Bob S > On Jun 3, 2017, at 09:46 , Richmond Mathewson via use-livecode > wrote: > > Not having looked at any sort of "serious" programming language since about > 1989 (I don't think that VB 6 is a serious language), > I find it hard to understand what a destructor is beyond a way to free memory > on a system that has constraints in that area. > > HOWEVER: as there is no thing in Livecode having "destrucor" written all over > it in big letters for slow characters > like myself could some one tell me: > > 1. Does Livecode have something(s) that does the job of a destructor? > > 2. If so, where is it and so on? > > 3. If not, why not? > > Richmond. ___ 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: Rooting around in the Forum: destructors
Thanks for the explanation: although, to be honest I've never really quite worked out what the difference is between Object-oriented languages and Object-based languages (I know that LiveCode is object-based). If being an Object-based language means you have pre-made objects to play around with and assign code-blocks/scripts to; well that makes sense to me. I suspect my lack of understanding re Object-oriented languages is because of my "BASIC/PASCAL/FORTRAN to HyperCard" leap. Reading the Wikipedia article on Object-oriented languages does not help because: "Object-oriented Programming uses objects" seems to conflict directly with stuff like this: #include int main() { std::cout << "Hello, world!\n"; return 0; } Richmond. On 6/3/17 9:40 pm, Mark Schonewille via use-livecode wrote: Short answer: LiveCode doesn't have destructors because the xTalk family of languages doesn't require them. xTalk languages make the life of the developer easier by taking such tasks our of their hands. 1a) Yes, under the hood, because LiveCode is written using variants of C, which are object oriented. So, LiveCode is creating and deleting (destructing) objects continuously, but the LiveCode developer/user doesn't need to be bothered with that. 1b) You could make sure to write clean scripts that always delete controls (and even cards and stacks) and variables that are no longer needed. LiveCode does a good job cleaning up after finishing a handler, so it isn't really necessary to do this yourself, but if you are creating controls that you need only one time, it is probably a good idea to delete them afterwards. When you delete a control, an object under the hood is no longer required and will be "destroyed" at some point. 2) It is in the object-oriented language that is used to create LiveCode. There is also a delete command in the LiveCode scripting language. The delete command isn't a destructor, but it does provide a form a cleaning up. 3) Most of the cleaning up is done automatically. Local variables that are used by one handler only, are deleted automatically. Moreover, the LiveCode scripting language isn't an object-oriented language, even though some people may try to make you believe otherwise and some other people wish it were. Really, it isn't. Because the language isn't object-oriented, it doesn't need a destructor. Kind regards, Mark Schonewille http://economy-x-talk.com https://www.facebook.com/marksch Buy the most extensive book on the LiveCode language: http://livecodebeginner.economy-x-talk.com Op 03-Jun-17 om 18:46 schreef Richmond Mathewson via use-livecode: http://forums.livecode.com/viewtopic.php?f=8&t=29319 Not having looked at any sort of "serious" programming language since about 1989 (I don't think that VB 6 is a serious language), I find it hard to understand what a destructor is beyond a way to free memory on a system that has constraints in that area. HOWEVER: as there is no thing in Livecode having "destrucor" written all over it in big letters for slow characters like myself could some one tell me: 1. Does Livecode have something(s) that does the job of a destructor? 2. If so, where is it and so on? 3. If not, why not? Richmond. ___ 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 ___ 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: Rooting around in the Forum: destructors
Short answer: LiveCode doesn't have destructors because the xTalk family of languages doesn't require them. xTalk languages make the life of the developer easier by taking such tasks our of their hands. 1a) Yes, under the hood, because LiveCode is written using variants of C, which are object oriented. So, LiveCode is creating and deleting (destructing) objects continuously, but the LiveCode developer/user doesn't need to be bothered with that. 1b) You could make sure to write clean scripts that always delete controls (and even cards and stacks) and variables that are no longer needed. LiveCode does a good job cleaning up after finishing a handler, so it isn't really necessary to do this yourself, but if you are creating controls that you need only one time, it is probably a good idea to delete them afterwards. When you delete a control, an object under the hood is no longer required and will be "destroyed" at some point. 2) It is in the object-oriented language that is used to create LiveCode. There is also a delete command in the LiveCode scripting language. The delete command isn't a destructor, but it does provide a form a cleaning up. 3) Most of the cleaning up is done automatically. Local variables that are used by one handler only, are deleted automatically. Moreover, the LiveCode scripting language isn't an object-oriented language, even though some people may try to make you believe otherwise and some other people wish it were. Really, it isn't. Because the language isn't object-oriented, it doesn't need a destructor. Kind regards, Mark Schonewille http://economy-x-talk.com https://www.facebook.com/marksch Buy the most extensive book on the LiveCode language: http://livecodebeginner.economy-x-talk.com Op 03-Jun-17 om 18:46 schreef Richmond Mathewson via use-livecode: http://forums.livecode.com/viewtopic.php?f=8&t=29319 Not having looked at any sort of "serious" programming language since about 1989 (I don't think that VB 6 is a serious language), I find it hard to understand what a destructor is beyond a way to free memory on a system that has constraints in that area. HOWEVER: as there is no thing in Livecode having "destrucor" written all over it in big letters for slow characters like myself could some one tell me: 1. Does Livecode have something(s) that does the job of a destructor? 2. If so, where is it and so on? 3. If not, why not? Richmond. ___ 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: Rooting around in the Forum: destructors
On 06/03/2017 09:46 AM, Richmond Mathewson via use-livecode wrote: http://forums.livecode.com/viewtopic.php?f=8&t=29319 Having now had a brief glance at that post, Guglielmo is correct. This has nothing to do with destructors. -- 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
Rooting around in the Forum: destructors
http://forums.livecode.com/viewtopic.php?f=8&t=29319 Not having looked at any sort of "serious" programming language since about 1989 (I don't think that VB 6 is a serious language), I find it hard to understand what a destructor is beyond a way to free memory on a system that has constraints in that area. HOWEVER: as there is no thing in Livecode having "destrucor" written all over it in big letters for slow characters like myself could some one tell me: 1. Does Livecode have something(s) that does the job of a destructor? 2. If so, where is it and so on? 3. If not, why not? Richmond. ___ 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