C++ needs the most elaborate mechanism because of its legacy preprocessor:
http://en.wikipedia.org/wiki/Include_guard

other languages like Java just refrain from having the compiler barf if
it's done twice, mostly. I don't know of any other languages that need an
elaborate mechanism, but I'm sure there are some; anyone here come across
one?


On Thu, Sep 12, 2013 at 3:17 AM, Piaget Modeler
<[email protected]>wrote:

> Any pointers to those mechanisms?
>
> Cheers,
>
> ~PM
>
> ------------------------------
> Date: Thu, 12 Sep 2013 03:12:13 +0100
> Subject: Re: [agi] Module re-definitions
> From: [email protected]
> To: [email protected]
>
>
> If ( exists(table(A))) then drop table A ;
>
> Create table A as blah blah blah...
>
>
> ee? no! that would break everything that refers to table A. modify it in
> place instead.
>
> ****
>
> ** **
>
> In 3 GL languages like C++, Java, etc. when a code module is accidentally
>
> included twice in a source file, what exactly happens? Does the compiler**
> **
>
> redefine or ignore the functions or objects in the duplicate module? What
> ****
>
> about interpreted languages like python?
>
>
> what you want is usually that importing a module is idempotent, i.e. doing
> it twice is the same as doing it once. The mechanisms by which this is
> achieved are very different in C++ versus Java but it is achieved
> nonetheless.
>    *AGI* | Archives <https://www.listbox.com/member/archive/303/=now>
> <https://www.listbox.com/member/archive/rss/303/19999924-4a978ccc> |
> Modify <https://www.listbox.com/member/?&;> Your Subscription
> <http://www.listbox.com>
>    *AGI* | Archives <https://www.listbox.com/member/archive/303/=now>
> <https://www.listbox.com/member/archive/rss/303/1658954-f53d1a3f> | 
> Modify<https://www.listbox.com/member/?&;>Your Subscription
> <http://www.listbox.com>
>



-------------------------------------------
AGI
Archives: https://www.listbox.com/member/archive/303/=now
RSS Feed: https://www.listbox.com/member/archive/rss/303/21088071-f452e424
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=21088071&id_secret=21088071-58d57657
Powered by Listbox: http://www.listbox.com

Reply via email to