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