[Grace-core] inconsistent defaults with modules

Andrew P. Black black at cs.pdx.edu
Fri May 30 08:37:45 PDT 2014


On 30 May 2014, at 0:12, Kim Bruce <KIM at cs.pomona.edu> wrote:

> However, the default for modules is that everything is public, and in fact attempts to annotate definitions and variable declarations to be confidential are accepted by the compiler, but ignored.  I.e., they are always visible to importing modules no matter what annotation is attached.  Interestingly, annotating a method to be confidential is effective.  It makes it invisible in the importing module.

I think that this is a compiler bug.

> While it would be a bit of a pain to annotate definitions (and variables if needed) to be public, I believe this is much more consistent with the rest of the language design.  

I agree.

> I've always been puzzled why the compiler does not implicitly wrap the code in a module/program as an object and treat it like all the other objects in the program.  A relatively easy fix may be to fix the compiler to do this, treating an imported module exactly like the other objects.  Is there a resin this should not be done?


Me too.  The compiler treats “top level” definitions completely differently from those inside objects.   If I recall, when we asked Michael about his, the reply was that this was for historical reasons.  That is, objects were introduced later, and the top level stuff was never reworked. 

My feeling is that the special treatment of “top level” should be removed, and all programs should be compiled as objects, in other words, that the implementation should be changed to conform to our current story about modules.   Bit this always seems like a fair bit of work, which was never urgent … until now, perhaps.

	Andrew




More information about the Grace-core mailing list