Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [handly-dev] IModule

Hi,

No, I don't think I can override. Or more precisely, I need both methods - some code needs just an IModule, other code needs the ISourceFile, and overriding would require instanceof checks. Some elements are specific to source code (comments, for example) and they would have to either cast the value or declare another method that would confuse things even more (which kind of module is getModule and which one is getErlModule?)

I don't have a good alternative, because each implementation might have different names and structure. 

ICodeContainer or ISourceContainer? This level is needed just for making a connection with the resource that contains the code.

IUnit or ICodeUnit or ISourceUnit might work too, as Ondrej suggested, but it collides with the JDT model's ICompilationUnit (which is an ISourceFile).

----
Now, thinking about it, even ISourceElement might not be a very good name either, because IModules need not contain source code. What we really have is a "code model". But maybe we should not go that far! :-)

regards,
Vlad 


On Fri, Mar 13, 2015 at 2:37 PM, Vladimir Piskarev <pisv@xxxxx> wrote:
Hi Vlad,
 
I wonder, couldn't you just override the return type of the getModule method (i.e. use a covariant return type), assuming that erlide modules would extend IModule?
 
I was thinking about a good name for a while, before IModule came to mind. I'm not saying the name cannot be changed, but I'm in lack of a good alternative... I realize that such generic term as "module" can cause ambiguities, but ISourceModule would not be quite correct, since the concept was introduced specifically to allow for "binary modules" (e.g. "IClassFile extend ISourceModule" would look a bit bogus IMO). Before IModule, I was agonizing around something like ISourceHost, which is abstract enough, but seems a bit ugly.
 
Any suggestions for a better name?
 
Thanks,
Vladimir
 
 
Hi!

I have a small problem with the new IModule, that I didn't realize it would be a problem... 

In Erlang, the unit of modularity is a module and my elements had a getModule method. Now This collides with ISourceElement's method and I have to rename it to getErlModule, which is not so nice because all other API doesn't have the "Erl" particle.

I realize it is a bit late to complain and suggest to rename it to ISourceModule or something similar, but I'll do it anyway :-)

best regards,
Vlad


_______________________________________________
handly-dev mailing list
handly-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/handly-dev


Back to the top