You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by David Savage <da...@paremus.com> on 2009/07/24 21:35:48 UTC

Visibility semantics

Hi there,

Having got some way into getting Sigil up and running on apache, I
think it's useful to start some dialog on it's functionality and
future direction. One of the open areas it would be good to get feed
back from the community is around the problem of class space
visibility and the different semantics at compile and runtime. That's
a bit hard to digest in a single sentence so I'll try to expand on
what this means...

One of the goals of Sigil is to use the same semantics at compile time
as used by OSGi to build a class space at runtime. To this end if you
have a dependency on some package in a certain range in the
sigil.properties file you say things like:

-imports: org.foo.example;version=[1.0.0,2.0.0)

The sigil resolver then walks it's way through the available
repositories to find the "best" bundle that satisfies this import
requirement via an export requirement and this bundle is added to your
classpath. In eclipse we (via the jdt compiler) we have the ability to
apply /real/ osgi rules to this to limit the visibility of other
packages not explicitly imported so you get nice red warning signals
in the IDE if you then reference another class from a different
package that you have not yet imported.

All good.

Where this breaks down with respect to the compiler is if you have a
class hierarchy as follows:

package org.foo;
public interface Top {
  public void doit();
}

package org.foo.example;
public interface Middle extends Top {
}

package org.bar.example {

import org.foo.example.Middle;

public class Other {
  public void broken() {
     Middle m = findMiddle();
     m.doit();
  }

  private Middle findMiddle() {
    // TODO find middle
    return null;
  }
}

If foo and bar are in different bundles and the bar bundle only
imports the org.foo.example package (which is all that is necessary at
runtime) this fails at compile time even if both packages are exported
from foo if we apply the OSGi rules exactly as stated above - as the
compiler needs visibility of the org.foo.Top class in order to know
that the doit() method exists. This is not required at runtime as the
org.foo bundle classloader does have visiblity of the Top class so it
can do the instantiation and hand the resultant object to org.bar.

The solution we've applied in Sigil up until this point is to add an
extra attribute to imports "resolve=compile":

-imports: \
  org.foo;version=[1.0.0,2.0.0);resolve=compile, \
  org.foo.example;version=[1.0.0,2.0.0)

This tells Sigil to make the package available for compilation but
removes the header from the manifest at runtime - as extra
dependencies are bad (standard OSGi mantra). *Note* we also discussed
whether to make this resolution=compile to match the OSGi semantic of
resolution=optional. However we decided to use a different tag as this
would actually be adding our own custom extensions to the OSGi spec
which is also generally viewed as bad...the counter argument to this
is you could say that the OSGi spec is a runtime spec and doesn't
touch on building (yet) so why not extend it?

However this is not the only problem, fragments also cause there own
unique problems to compilation. Consider that the org.eclipse.swt
bundle /claims/ to export a set of packages org.eclipse.swt,
org.eclipse.swt.image, etc. But in actual fact the packages are not
contained in this bundle but are attached via platform specific
fragments org.eclipse.swt.macosx...At runtime this is all fine if you
just specify import package or require bundle then you get the correct
behaviour if the fragment is loaded. However at compile time this puts
an implicit dependency on /some/ fragment to be available to the
compiler to provide the classes. One potential solution for this I've
mentioned here:

https://issues.apache.org/jira/browse/FELIX-1407

This would allow the sigil.properties file to have a compile only
Requires-Bundle dependency on a fragment that would make the classes
visible but this would get stripped from the manifest at runtime so
the bundle would function as normal. *Note* this is also a "live"
problem for the conversion of Sigil to be self hosting as it depends
on the SWT classes so has this exact problem. I have the current
compilation working by adding the requirement for the fragment.
However this causes the bundle to fail to deploy at runtime in
environments that do not have this fragment (i.e. windows, linux etc
:(

To lay my cards on the table, I kinda like resolve=compile as it dove
tails kinda neatly with resolution=optional, but equally it seems
kinda bizarre to be adding another dimension to this whole problem
when people are worried about the complexity of OSGi. If there is a
way to do this without exposing developers to it that would be /great/
but as with OSGi I don't think we should worry about doing the right
thing at the base layer IDE tools and other schemes can always
simpilify this whole space down again to joe blogs. I guess it's a
question of what is "right".

So I guess the end result of this email is, what are your thoughts?

* Is resolve=compile a good idea?
* Should it be resolution=compile?
* Any other options?
* What to do about fragments?
* Is anyone still there (i.e. has this email lost you all?)?

Regards,

Dave

Re: Visibility semantics

Posted by Marcel Offermans <ma...@luminis.nl>.
Hello David,

On Jul 24, 2009, at 21:35 , David Savage wrote:

> One of the open areas it would be good to get feed
> back from the community is around the problem of class space
> visibility and the different semantics at compile and runtime.

What I would like to do is to look at this from an architectural point  
of view. When developing an application, I often use the "4+1  
view" [1], and the views we're dealing with here are:
1) the "development view", dealing with components and packages, which  
basically maps to our compile time view of the application, and
2) the "physical view" (or "deployment view"), which deals with "the  
allocation of artifacts to nodes" and basically deals with the runtime  
view you mention above.

In my mind, these views are different by design and my main reason for  
not liking both the Eclipse and the Maven models (one bundle per  
project/pom) is that they completely ignore these differences and  
force everybody into thinking both should be the same.

> One of the goals of Sigil is to use the same semantics at compile time
> as used by OSGi to build a class space at runtime.

If you stick to the idea that both views are not the same then let's  
look at each view in more detail.

The development view, when creating an application, is usually a  
consistent class space, built out of both code you develop and third  
party code you use. In general, this maps quite nicely onto a single  
IDE project.

The deployment view is basically something you create out of the  
classes that were created in the development view. You can look at  
this view as some kind of mapping that describes how classes (or  
packages) are grouped into bundles. I could imagine having some kind  
of XML model that describes this mapping and that can somehow be  
validated.

> [...] but equally it seems
> kinda bizarre to be adding another dimension to this whole problem
> when people are worried about the complexity of OSGi. If there is a
> way to do this without exposing developers to it that would be /great/
> but as with OSGi I don't think we should worry about doing the right
> thing at the base layer IDE tools and other schemes can always
> simpilify this whole space down again to joe blogs. I guess it's a
> question of what is "right".

I agree here, we should first try to figure out what is "right" and  
from there make it "easier". Of course, part of "easier", at least in  
my book, would mean that whatever we come up with is not tied to a  
single IDE implementation (at least I don't fancy writing and  
maintaining multiple IDE integrations).

> So I guess the end result of this email is, what are your thoughts?

I skipped parts of your mail, because I wanted to discuss some overall  
concepts first.

> * Is anyone still there (i.e. has this email lost you all?)?

I hope so! :)

Greetings, Marcel

[1] http://en.wikipedia.org/wiki/4%2B1_Architectural_View_Model


Re: Visibility semantics

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/30/09 12:35 PM, David Savage wrote:
> On Wed, Jul 29, 2009 at 2:36 PM, Richard S. Hall<he...@ungoverned.org>  wrote:
>    
>> On 7/29/09 4:56 AM, David Savage wrote:
>>      
>>> On Tue, Jul 28, 2009 at 5:35 PM, Richard S. Hall<he...@ungoverned.org>
>>>   wrote:
>>>
>>>        
>>>> On 7/28/09 12:21 PM, David Savage wrote:
>>>>
>>>>          
>>>>> On Tue, Jul 28, 2009 at 3:34 PM, Richard S. Hall<he...@ungoverned.org>
>>>>>   wrote:
>>>>>
>>>>>
>>>>>            
>>>>>> On 7/28/09 9:47 AM, David Savage wrote:
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org>
>>>>>>>   wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>>>> On 7/27/09 8:24 AM, David Savage wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>>>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S.
>>>>>>>>> Hall<he...@ungoverned.org>
>>>>>>>>>   wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                      
>>>>>>>>>>> To lay my cards on the table, I kinda like resolve=compile as it
>>>>>>>>>>> dove
>>>>>>>>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>>>>>>>>> kinda bizarre to be adding another dimension to this whole problem
>>>>>>>>>>> when people are worried about the complexity of OSGi. If there is
>>>>>>>>>>> a
>>>>>>>>>>> way to do this without exposing developers to it that would be
>>>>>>>>>>> /great/
>>>>>>>>>>> but as with OSGi I don't think we should worry about doing the
>>>>>>>>>>> right
>>>>>>>>>>> thing at the base layer IDE tools and other schemes can always
>>>>>>>>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>>>>>>>>> question of what is "right".
>>>>>>>>>>>
>>>>>>>>>>> So I guess the end result of this email is, what are your
>>>>>>>>>>> thoughts?
>>>>>>>>>>>
>>>>>>>>>>> * Is resolve=compile a good idea?
>>>>>>>>>>> * Should it be resolution=compile?
>>>>>>>>>>> * Any other options?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                        
>>>>>>>>>> Isn't this some form of "uses" constraint? Middle exposes Top
>>>>>>>>>> because
>>>>>>>>>> it
>>>>>>>>>> inherits from it, so if you follow transitive "uses" constraints
>>>>>>>>>> you
>>>>>>>>>> could
>>>>>>>>>> possibly assume that compile-time access is needed.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                      
>>>>>>>>> Hmmm you're right it certainly resembles uses - should have spotted
>>>>>>>>> that myself. However I have a feeling it may get a bit hairy in
>>>>>>>>> certain edge cases, i.e. Top may not be in an exported package which
>>>>>>>>> could work at runtime I believe, as Middle would provide the class
>>>>>>>>> path to Top?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>> I agree, it might not work in every case, but it seems like a good
>>>>>>>> place
>>>>>>>> to
>>>>>>>> start. It seems in the general case, if a type is exposed, then
>>>>>>>> someone
>>>>>>>> must
>>>>>>>> have a dependency on it or contain it somewhere in the transitive set
>>>>>>>> of
>>>>>>>> dependencies, otherwise it couldn't be exposed...
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>> I guess the only concern I have with this approach is making sure it
>>>>>>> doesn't get in the way of developers - i.e. the uses should be
>>>>>>> calculated by the tooling vs expecting the developers to manage this
>>>>>>> manually. Uses is a pretty nasty equation to calculate at runtime and
>>>>>>> in an IDE environment where devs are cutting/refactoring code I guess
>>>>>>> I'm just wary that it has the possibility to spin out of control and
>>>>>>> lock up the IDE. Also should be careful at implementation time to
>>>>>>> allow the calculation to be done in such a way as to allow caching so
>>>>>>> it doesn't grind the IDE to a halt.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>> I worry about this during framework run time too! :-)
>>>>>>
>>>>>> That's why we need to devise a decent algorithm that doesn't do this
>>>>>> and
>>>>>> we
>>>>>> can share among our subprojects that require resolving.
>>>>>>
>>>>>>
>>>>>>              
>>>>> Yep that would certainly be very useful! One of the comments made
>>>>> during the sigil contribution was regarding building a resolver API
>>>>> that could be reused and implemented in different ways, either for
>>>>> research purposes or to allow for different behaviours - fast, logical
>>>>> error messages, extended semantics, etc. Maybe we could look at some
>>>>> combination of code from Felix, OBR and Sigil to form the basis of an
>>>>> API?
>>>>>
>>>>> The key parts of the sigil resolver (I think) are:
>>>>>
>>>>> * support for progress notifications (allows for UI analysis of
>>>>> resolutions)
>>>>> * pluggable repositories (i.e. sources of bundles - filesystem, obr,
>>>>> etc)
>>>>> * support for hierarchical repositories (allows developers to chose
>>>>> where they would "prefer" to resolve resources from)
>>>>>
>>>>>
>>>>>            
>>>> While all of this sounds good, I was more alluding the algorithm
>>>> itself...the API is the easy part if we have an algorithm that is wicked
>>>> fast. :-)
>>>>
>>>>          
>>> Sure, I agree it's definitely possible to build an algorithm in
>>> isolation which is harder than the API. I just wonder whether there
>>> would be more impetus to try solving this if there were a pluggable
>>> API - kinda chicken and egg thing. I suspect there's a few people out
>>> there working on this problem but they don't necessarily want to
>>> donate the code to apache? If there were an API they could plug into
>>> then they could develop the code prove it worked and potentially
>>> contribute it later if they so wished? Might even spur some healthy
>>> competition in this area...
>>>
>>>        
>> Perhaps so. The Felix resolver API is now reasonably pluggable, just
>> implement Resolver, but there is no easy way to configure it...and it still
>> does need some improvement.
>>      
>
> Ok that sounds like an interesting place to start, I'll have a dig
> around and raise some issues or come back with some specific questions
> on this in a separate thread as I think this conversation has wondered
> off topic from the original point about how to express class
> visibility at runtime. Uses certainly seems to have some merit for
> compile time visibility...
>    

Indeed.

For the time being, however, improving this API will be a lower priority 
to me than improving the performance of the existing implementation. 
However, specific issues with fairly simple resolutions are possible.

-> richard

> Regards,
>
> Dave
>
>    
>>> Also I think wicked fast depends on your scope - for a runtime the
>>> problem is generally wiring together an order of around hundred or so
>>> bundles? For a development environment this potentially has visibility
>>> of a /lot/ more - i.e. in worst case all bundles ever developed. So
>>> this could be thousands, tens of thousands (or dare I say it millions)
>>> of bundles, solving uses in this area sounds (on first pass) pretty
>>> scary...
>>>
>>>        
>> Well, in Equinox they regularly talk about use cases with 1000s of bundles.
>> Regardless, it is not that difficult to create scenarios which are slow to
>> resolve when you combined hundreds of bundles with hundreds of
>> imports/exports with tons of "uses" constraints. I've seen them first hand.
>> ;-)
>>
>> ->  richard
>>
>>      
>>> Obviously one step at a time and nothing stopping people improving the
>>> algorithm now as you say, but allowing different research teams the
>>> ability to try different algorithms in the scope of a single resolver
>>> API sounds pretty neat to me ;)
>>>
>>> Regards,
>>>
>>> Dave
>>>
>>>
>>>        
>>>> ->    richard
>>>>
>>>>
>>>>          
>>>>> Regards,
>>>>>
>>>>> Dave
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>>> ->      richard
>>>>>>
>>>>>>
>>>>>>
>>>>>>              
>>>>>>>>>>> * What to do about fragments?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                        
>>>>>>>>>> I don't think the fragment issue should be handled, since that is a
>>>>>>>>>> bogus
>>>>>>>>>> use case for fragments from my point of view. Fragments are
>>>>>>>>>> intended
>>>>>>>>>> to
>>>>>>>>>> be
>>>>>>>>>> optional extensions to the host, but in this case the host is
>>>>>>>>>> fibbing
>>>>>>>>>> about
>>>>>>>>>> its contents because it expects to have a fragment attached to it.
>>>>>>>>>> In
>>>>>>>>>> reality, the fragment should have the exports, not the host.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                      
>>>>>>>>> Tend to agree it is a bogus scenario - if only it wasn't happening
>>>>>>>>> in
>>>>>>>>> one of the most used OSGi libraries available :( I guess Eclipse
>>>>>>>>> probably have a good reason for doing this - not sure what but I'll
>>>>>>>>> give them the benefit of the doubt.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>> Regardless, it doesn't seem like a good idea to create whole new
>>>>>>>> mechanisms
>>>>>>>> to support improper use cases.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>> Agree in principle and I certainly want sigil to encourage best
>>>>>>> practice OSGi development. But in real world projects the edges are
>>>>>>> very rarely clean cut - so we need to provide migration paths at
>>>>>>> least. I'll push this out for the time being as I have a work around
>>>>>>> for fragments of this type - it's a bit messy but involves no new
>>>>>>> options on require bundle at least.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Dave
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>>>> ->        richard
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>>>> I think I've figured out a way to work around it for the time being
>>>>>>>>> -
>>>>>>>>> which takes the pressure off from a sigil release point of view.
>>>>>>>>> I'll
>>>>>>>>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>>>>>>>>> so I can at least compile against it without dragging in an external
>>>>>>>>> dependency at runtime. The danger with this approach is that unwary
>>>>>>>>> developers may link against a non exported package by mistake. Just
>>>>>>>>> wonder if there is a way to make this work without complicating the
>>>>>>>>> development model (or the sigil code) too much...
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>>>> ->          richard
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                      
>>>>>>>>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>>
>>>>>>>>>>> Dave
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                        
>>>>>>>>>                    

Re: Visibility semantics

Posted by David Savage <da...@paremus.com>.
On Wed, Jul 29, 2009 at 2:36 PM, Richard S. Hall<he...@ungoverned.org> wrote:
> On 7/29/09 4:56 AM, David Savage wrote:
>>
>> On Tue, Jul 28, 2009 at 5:35 PM, Richard S. Hall<he...@ungoverned.org>
>>  wrote:
>>
>>>
>>> On 7/28/09 12:21 PM, David Savage wrote:
>>>
>>>>
>>>> On Tue, Jul 28, 2009 at 3:34 PM, Richard S. Hall<he...@ungoverned.org>
>>>>  wrote:
>>>>
>>>>
>>>>>
>>>>> On 7/28/09 9:47 AM, David Savage wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org>
>>>>>>  wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> On 7/27/09 8:24 AM, David Savage wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S.
>>>>>>>> Hall<he...@ungoverned.org>
>>>>>>>>  wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> To lay my cards on the table, I kinda like resolve=compile as it
>>>>>>>>>> dove
>>>>>>>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>>>>>>>> kinda bizarre to be adding another dimension to this whole problem
>>>>>>>>>> when people are worried about the complexity of OSGi. If there is
>>>>>>>>>> a
>>>>>>>>>> way to do this without exposing developers to it that would be
>>>>>>>>>> /great/
>>>>>>>>>> but as with OSGi I don't think we should worry about doing the
>>>>>>>>>> right
>>>>>>>>>> thing at the base layer IDE tools and other schemes can always
>>>>>>>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>>>>>>>> question of what is "right".
>>>>>>>>>>
>>>>>>>>>> So I guess the end result of this email is, what are your
>>>>>>>>>> thoughts?
>>>>>>>>>>
>>>>>>>>>> * Is resolve=compile a good idea?
>>>>>>>>>> * Should it be resolution=compile?
>>>>>>>>>> * Any other options?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Isn't this some form of "uses" constraint? Middle exposes Top
>>>>>>>>> because
>>>>>>>>> it
>>>>>>>>> inherits from it, so if you follow transitive "uses" constraints
>>>>>>>>> you
>>>>>>>>> could
>>>>>>>>> possibly assume that compile-time access is needed.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> Hmmm you're right it certainly resembles uses - should have spotted
>>>>>>>> that myself. However I have a feeling it may get a bit hairy in
>>>>>>>> certain edge cases, i.e. Top may not be in an exported package which
>>>>>>>> could work at runtime I believe, as Middle would provide the class
>>>>>>>> path to Top?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> I agree, it might not work in every case, but it seems like a good
>>>>>>> place
>>>>>>> to
>>>>>>> start. It seems in the general case, if a type is exposed, then
>>>>>>> someone
>>>>>>> must
>>>>>>> have a dependency on it or contain it somewhere in the transitive set
>>>>>>> of
>>>>>>> dependencies, otherwise it couldn't be exposed...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> I guess the only concern I have with this approach is making sure it
>>>>>> doesn't get in the way of developers - i.e. the uses should be
>>>>>> calculated by the tooling vs expecting the developers to manage this
>>>>>> manually. Uses is a pretty nasty equation to calculate at runtime and
>>>>>> in an IDE environment where devs are cutting/refactoring code I guess
>>>>>> I'm just wary that it has the possibility to spin out of control and
>>>>>> lock up the IDE. Also should be careful at implementation time to
>>>>>> allow the calculation to be done in such a way as to allow caching so
>>>>>> it doesn't grind the IDE to a halt.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> I worry about this during framework run time too! :-)
>>>>>
>>>>> That's why we need to devise a decent algorithm that doesn't do this
>>>>> and
>>>>> we
>>>>> can share among our subprojects that require resolving.
>>>>>
>>>>>
>>>>
>>>> Yep that would certainly be very useful! One of the comments made
>>>> during the sigil contribution was regarding building a resolver API
>>>> that could be reused and implemented in different ways, either for
>>>> research purposes or to allow for different behaviours - fast, logical
>>>> error messages, extended semantics, etc. Maybe we could look at some
>>>> combination of code from Felix, OBR and Sigil to form the basis of an
>>>> API?
>>>>
>>>> The key parts of the sigil resolver (I think) are:
>>>>
>>>> * support for progress notifications (allows for UI analysis of
>>>> resolutions)
>>>> * pluggable repositories (i.e. sources of bundles - filesystem, obr,
>>>> etc)
>>>> * support for hierarchical repositories (allows developers to chose
>>>> where they would "prefer" to resolve resources from)
>>>>
>>>>
>>>
>>> While all of this sounds good, I was more alluding the algorithm
>>> itself...the API is the easy part if we have an algorithm that is wicked
>>> fast. :-)
>>>
>>
>> Sure, I agree it's definitely possible to build an algorithm in
>> isolation which is harder than the API. I just wonder whether there
>> would be more impetus to try solving this if there were a pluggable
>> API - kinda chicken and egg thing. I suspect there's a few people out
>> there working on this problem but they don't necessarily want to
>> donate the code to apache? If there were an API they could plug into
>> then they could develop the code prove it worked and potentially
>> contribute it later if they so wished? Might even spur some healthy
>> competition in this area...
>>
>
> Perhaps so. The Felix resolver API is now reasonably pluggable, just
> implement Resolver, but there is no easy way to configure it...and it still
> does need some improvement.

Ok that sounds like an interesting place to start, I'll have a dig
around and raise some issues or come back with some specific questions
on this in a separate thread as I think this conversation has wondered
off topic from the original point about how to express class
visibility at runtime. Uses certainly seems to have some merit for
compile time visibility...

Regards,

Dave

>
>> Also I think wicked fast depends on your scope - for a runtime the
>> problem is generally wiring together an order of around hundred or so
>> bundles? For a development environment this potentially has visibility
>> of a /lot/ more - i.e. in worst case all bundles ever developed. So
>> this could be thousands, tens of thousands (or dare I say it millions)
>> of bundles, solving uses in this area sounds (on first pass) pretty
>> scary...
>>
>
> Well, in Equinox they regularly talk about use cases with 1000s of bundles.
> Regardless, it is not that difficult to create scenarios which are slow to
> resolve when you combined hundreds of bundles with hundreds of
> imports/exports with tons of "uses" constraints. I've seen them first hand.
> ;-)
>
> -> richard
>
>> Obviously one step at a time and nothing stopping people improving the
>> algorithm now as you say, but allowing different research teams the
>> ability to try different algorithms in the scope of a single resolver
>> API sounds pretty neat to me ;)
>>
>> Regards,
>>
>> Dave
>>
>>
>>>
>>> ->  richard
>>>
>>>
>>>>
>>>> Regards,
>>>>
>>>> Dave
>>>>
>>>>
>>>>
>>>>>
>>>>> ->    richard
>>>>>
>>>>>
>>>>>
>>>>>>>>>>
>>>>>>>>>> * What to do about fragments?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I don't think the fragment issue should be handled, since that is a
>>>>>>>>> bogus
>>>>>>>>> use case for fragments from my point of view. Fragments are
>>>>>>>>> intended
>>>>>>>>> to
>>>>>>>>> be
>>>>>>>>> optional extensions to the host, but in this case the host is
>>>>>>>>> fibbing
>>>>>>>>> about
>>>>>>>>> its contents because it expects to have a fragment attached to it.
>>>>>>>>> In
>>>>>>>>> reality, the fragment should have the exports, not the host.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> Tend to agree it is a bogus scenario - if only it wasn't happening
>>>>>>>> in
>>>>>>>> one of the most used OSGi libraries available :( I guess Eclipse
>>>>>>>> probably have a good reason for doing this - not sure what but I'll
>>>>>>>> give them the benefit of the doubt.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> Regardless, it doesn't seem like a good idea to create whole new
>>>>>>> mechanisms
>>>>>>> to support improper use cases.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> Agree in principle and I certainly want sigil to encourage best
>>>>>> practice OSGi development. But in real world projects the edges are
>>>>>> very rarely clean cut - so we need to provide migration paths at
>>>>>> least. I'll push this out for the time being as I have a work around
>>>>>> for fragments of this type - it's a bit messy but involves no new
>>>>>> options on require bundle at least.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> ->      richard
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> I think I've figured out a way to work around it for the time being
>>>>>>>> -
>>>>>>>> which takes the pressure off from a sigil release point of view.
>>>>>>>> I'll
>>>>>>>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>>>>>>>> so I can at least compile against it without dragging in an external
>>>>>>>> dependency at runtime. The danger with this approach is that unwary
>>>>>>>> developers may link against a non exported package by mistake. Just
>>>>>>>> wonder if there is a way to make this work without complicating the
>>>>>>>> development model (or the sigil code) too much...
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> ->        richard
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>>
>>>>>>>>>> Dave
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>

Re: Visibility semantics

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/29/09 4:56 AM, David Savage wrote:
> On Tue, Jul 28, 2009 at 5:35 PM, Richard S. Hall<he...@ungoverned.org>  wrote:
>    
>> On 7/28/09 12:21 PM, David Savage wrote:
>>      
>>> On Tue, Jul 28, 2009 at 3:34 PM, Richard S. Hall<he...@ungoverned.org>
>>>   wrote:
>>>
>>>        
>>>> On 7/28/09 9:47 AM, David Savage wrote:
>>>>
>>>>          
>>>>> On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org>
>>>>>   wrote:
>>>>>
>>>>>
>>>>>            
>>>>>> On 7/27/09 8:24 AM, David Savage wrote:
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S.
>>>>>>> Hall<he...@ungoverned.org>
>>>>>>>   wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>>>> To lay my cards on the table, I kinda like resolve=compile as it
>>>>>>>>> dove
>>>>>>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>>>>>>> kinda bizarre to be adding another dimension to this whole problem
>>>>>>>>> when people are worried about the complexity of OSGi. If there is a
>>>>>>>>> way to do this without exposing developers to it that would be
>>>>>>>>> /great/
>>>>>>>>> but as with OSGi I don't think we should worry about doing the right
>>>>>>>>> thing at the base layer IDE tools and other schemes can always
>>>>>>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>>>>>>> question of what is "right".
>>>>>>>>>
>>>>>>>>> So I guess the end result of this email is, what are your thoughts?
>>>>>>>>>
>>>>>>>>> * Is resolve=compile a good idea?
>>>>>>>>> * Should it be resolution=compile?
>>>>>>>>> * Any other options?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>> Isn't this some form of "uses" constraint? Middle exposes Top because
>>>>>>>> it
>>>>>>>> inherits from it, so if you follow transitive "uses" constraints you
>>>>>>>> could
>>>>>>>> possibly assume that compile-time access is needed.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>> Hmmm you're right it certainly resembles uses - should have spotted
>>>>>>> that myself. However I have a feeling it may get a bit hairy in
>>>>>>> certain edge cases, i.e. Top may not be in an exported package which
>>>>>>> could work at runtime I believe, as Middle would provide the class
>>>>>>> path to Top?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>> I agree, it might not work in every case, but it seems like a good
>>>>>> place
>>>>>> to
>>>>>> start. It seems in the general case, if a type is exposed, then someone
>>>>>> must
>>>>>> have a dependency on it or contain it somewhere in the transitive set
>>>>>> of
>>>>>> dependencies, otherwise it couldn't be exposed...
>>>>>>
>>>>>>
>>>>>>              
>>>>> I guess the only concern I have with this approach is making sure it
>>>>> doesn't get in the way of developers - i.e. the uses should be
>>>>> calculated by the tooling vs expecting the developers to manage this
>>>>> manually. Uses is a pretty nasty equation to calculate at runtime and
>>>>> in an IDE environment where devs are cutting/refactoring code I guess
>>>>> I'm just wary that it has the possibility to spin out of control and
>>>>> lock up the IDE. Also should be careful at implementation time to
>>>>> allow the calculation to be done in such a way as to allow caching so
>>>>> it doesn't grind the IDE to a halt.
>>>>>
>>>>>
>>>>>            
>>>> I worry about this during framework run time too! :-)
>>>>
>>>> That's why we need to devise a decent algorithm that doesn't do this and
>>>> we
>>>> can share among our subprojects that require resolving.
>>>>
>>>>          
>>> Yep that would certainly be very useful! One of the comments made
>>> during the sigil contribution was regarding building a resolver API
>>> that could be reused and implemented in different ways, either for
>>> research purposes or to allow for different behaviours - fast, logical
>>> error messages, extended semantics, etc. Maybe we could look at some
>>> combination of code from Felix, OBR and Sigil to form the basis of an
>>> API?
>>>
>>> The key parts of the sigil resolver (I think) are:
>>>
>>> * support for progress notifications (allows for UI analysis of
>>> resolutions)
>>> * pluggable repositories (i.e. sources of bundles - filesystem, obr, etc)
>>> * support for hierarchical repositories (allows developers to chose
>>> where they would "prefer" to resolve resources from)
>>>
>>>        
>> While all of this sounds good, I was more alluding the algorithm
>> itself...the API is the easy part if we have an algorithm that is wicked
>> fast. :-)
>>      
>
> Sure, I agree it's definitely possible to build an algorithm in
> isolation which is harder than the API. I just wonder whether there
> would be more impetus to try solving this if there were a pluggable
> API - kinda chicken and egg thing. I suspect there's a few people out
> there working on this problem but they don't necessarily want to
> donate the code to apache? If there were an API they could plug into
> then they could develop the code prove it worked and potentially
> contribute it later if they so wished? Might even spur some healthy
> competition in this area...
>    

Perhaps so. The Felix resolver API is now reasonably pluggable, just 
implement Resolver, but there is no easy way to configure it...and it 
still does need some improvement.

> Also I think wicked fast depends on your scope - for a runtime the
> problem is generally wiring together an order of around hundred or so
> bundles? For a development environment this potentially has visibility
> of a /lot/ more - i.e. in worst case all bundles ever developed. So
> this could be thousands, tens of thousands (or dare I say it millions)
> of bundles, solving uses in this area sounds (on first pass) pretty
> scary...
>    

Well, in Equinox they regularly talk about use cases with 1000s of 
bundles. Regardless, it is not that difficult to create scenarios which 
are slow to resolve when you combined hundreds of bundles with hundreds 
of imports/exports with tons of "uses" constraints. I've seen them first 
hand. ;-)

-> richard

> Obviously one step at a time and nothing stopping people improving the
> algorithm now as you say, but allowing different research teams the
> ability to try different algorithms in the scope of a single resolver
> API sounds pretty neat to me ;)
>
> Regards,
>
> Dave
>
>    
>> ->  richard
>>
>>      
>>> Regards,
>>>
>>> Dave
>>>
>>>
>>>        
>>>> ->    richard
>>>>
>>>>
>>>>          
>>>>>>>>> * What to do about fragments?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>> I don't think the fragment issue should be handled, since that is a
>>>>>>>> bogus
>>>>>>>> use case for fragments from my point of view. Fragments are intended
>>>>>>>> to
>>>>>>>> be
>>>>>>>> optional extensions to the host, but in this case the host is fibbing
>>>>>>>> about
>>>>>>>> its contents because it expects to have a fragment attached to it. In
>>>>>>>> reality, the fragment should have the exports, not the host.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>> Tend to agree it is a bogus scenario - if only it wasn't happening in
>>>>>>> one of the most used OSGi libraries available :( I guess Eclipse
>>>>>>> probably have a good reason for doing this - not sure what but I'll
>>>>>>> give them the benefit of the doubt.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>> Regardless, it doesn't seem like a good idea to create whole new
>>>>>> mechanisms
>>>>>> to support improper use cases.
>>>>>>
>>>>>>
>>>>>>              
>>>>> Agree in principle and I certainly want sigil to encourage best
>>>>> practice OSGi development. But in real world projects the edges are
>>>>> very rarely clean cut - so we need to provide migration paths at
>>>>> least. I'll push this out for the time being as I have a work around
>>>>> for fragments of this type - it's a bit messy but involves no new
>>>>> options on require bundle at least.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Dave
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>>> ->      richard
>>>>>>
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> I think I've figured out a way to work around it for the time being -
>>>>>>> which takes the pressure off from a sigil release point of view. I'll
>>>>>>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>>>>>>> so I can at least compile against it without dragging in an external
>>>>>>> dependency at runtime. The danger with this approach is that unwary
>>>>>>> developers may link against a non exported package by mistake. Just
>>>>>>> wonder if there is a way to make this work without complicating the
>>>>>>> development model (or the sigil code) too much...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>>>> ->        richard
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                  
>>>>>>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Dave
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>                

Re: Visibility semantics

Posted by David Savage <da...@paremus.com>.
On Tue, Jul 28, 2009 at 5:35 PM, Richard S. Hall<he...@ungoverned.org> wrote:
> On 7/28/09 12:21 PM, David Savage wrote:
>>
>> On Tue, Jul 28, 2009 at 3:34 PM, Richard S. Hall<he...@ungoverned.org>
>>  wrote:
>>
>>>
>>> On 7/28/09 9:47 AM, David Savage wrote:
>>>
>>>>
>>>> On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org>
>>>>  wrote:
>>>>
>>>>
>>>>>
>>>>> On 7/27/09 8:24 AM, David Savage wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S.
>>>>>> Hall<he...@ungoverned.org>
>>>>>>  wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> To lay my cards on the table, I kinda like resolve=compile as it
>>>>>>>> dove
>>>>>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>>>>>> kinda bizarre to be adding another dimension to this whole problem
>>>>>>>> when people are worried about the complexity of OSGi. If there is a
>>>>>>>> way to do this without exposing developers to it that would be
>>>>>>>> /great/
>>>>>>>> but as with OSGi I don't think we should worry about doing the right
>>>>>>>> thing at the base layer IDE tools and other schemes can always
>>>>>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>>>>>> question of what is "right".
>>>>>>>>
>>>>>>>> So I guess the end result of this email is, what are your thoughts?
>>>>>>>>
>>>>>>>> * Is resolve=compile a good idea?
>>>>>>>> * Should it be resolution=compile?
>>>>>>>> * Any other options?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> Isn't this some form of "uses" constraint? Middle exposes Top because
>>>>>>> it
>>>>>>> inherits from it, so if you follow transitive "uses" constraints you
>>>>>>> could
>>>>>>> possibly assume that compile-time access is needed.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> Hmmm you're right it certainly resembles uses - should have spotted
>>>>>> that myself. However I have a feeling it may get a bit hairy in
>>>>>> certain edge cases, i.e. Top may not be in an exported package which
>>>>>> could work at runtime I believe, as Middle would provide the class
>>>>>> path to Top?
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> I agree, it might not work in every case, but it seems like a good
>>>>> place
>>>>> to
>>>>> start. It seems in the general case, if a type is exposed, then someone
>>>>> must
>>>>> have a dependency on it or contain it somewhere in the transitive set
>>>>> of
>>>>> dependencies, otherwise it couldn't be exposed...
>>>>>
>>>>>
>>>>
>>>> I guess the only concern I have with this approach is making sure it
>>>> doesn't get in the way of developers - i.e. the uses should be
>>>> calculated by the tooling vs expecting the developers to manage this
>>>> manually. Uses is a pretty nasty equation to calculate at runtime and
>>>> in an IDE environment where devs are cutting/refactoring code I guess
>>>> I'm just wary that it has the possibility to spin out of control and
>>>> lock up the IDE. Also should be careful at implementation time to
>>>> allow the calculation to be done in such a way as to allow caching so
>>>> it doesn't grind the IDE to a halt.
>>>>
>>>>
>>>
>>> I worry about this during framework run time too! :-)
>>>
>>> That's why we need to devise a decent algorithm that doesn't do this and
>>> we
>>> can share among our subprojects that require resolving.
>>>
>>
>> Yep that would certainly be very useful! One of the comments made
>> during the sigil contribution was regarding building a resolver API
>> that could be reused and implemented in different ways, either for
>> research purposes or to allow for different behaviours - fast, logical
>> error messages, extended semantics, etc. Maybe we could look at some
>> combination of code from Felix, OBR and Sigil to form the basis of an
>> API?
>>
>> The key parts of the sigil resolver (I think) are:
>>
>> * support for progress notifications (allows for UI analysis of
>> resolutions)
>> * pluggable repositories (i.e. sources of bundles - filesystem, obr, etc)
>> * support for hierarchical repositories (allows developers to chose
>> where they would "prefer" to resolve resources from)
>>
>
> While all of this sounds good, I was more alluding the algorithm
> itself...the API is the easy part if we have an algorithm that is wicked
> fast. :-)

Sure, I agree it's definitely possible to build an algorithm in
isolation which is harder than the API. I just wonder whether there
would be more impetus to try solving this if there were a pluggable
API - kinda chicken and egg thing. I suspect there's a few people out
there working on this problem but they don't necessarily want to
donate the code to apache? If there were an API they could plug into
then they could develop the code prove it worked and potentially
contribute it later if they so wished? Might even spur some healthy
competition in this area...

Also I think wicked fast depends on your scope - for a runtime the
problem is generally wiring together an order of around hundred or so
bundles? For a development environment this potentially has visibility
of a /lot/ more - i.e. in worst case all bundles ever developed. So
this could be thousands, tens of thousands (or dare I say it millions)
of bundles, solving uses in this area sounds (on first pass) pretty
scary...

Obviously one step at a time and nothing stopping people improving the
algorithm now as you say, but allowing different research teams the
ability to try different algorithms in the scope of a single resolver
API sounds pretty neat to me ;)

Regards,

Dave

>
> -> richard
>
>> Regards,
>>
>> Dave
>>
>>
>>>
>>> ->  richard
>>>
>>>
>>>>>>>>
>>>>>>>> * What to do about fragments?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> I don't think the fragment issue should be handled, since that is a
>>>>>>> bogus
>>>>>>> use case for fragments from my point of view. Fragments are intended
>>>>>>> to
>>>>>>> be
>>>>>>> optional extensions to the host, but in this case the host is fibbing
>>>>>>> about
>>>>>>> its contents because it expects to have a fragment attached to it. In
>>>>>>> reality, the fragment should have the exports, not the host.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> Tend to agree it is a bogus scenario - if only it wasn't happening in
>>>>>> one of the most used OSGi libraries available :( I guess Eclipse
>>>>>> probably have a good reason for doing this - not sure what but I'll
>>>>>> give them the benefit of the doubt.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> Regardless, it doesn't seem like a good idea to create whole new
>>>>> mechanisms
>>>>> to support improper use cases.
>>>>>
>>>>>
>>>>
>>>> Agree in principle and I certainly want sigil to encourage best
>>>> practice OSGi development. But in real world projects the edges are
>>>> very rarely clean cut - so we need to provide migration paths at
>>>> least. I'll push this out for the time being as I have a work around
>>>> for fragments of this type - it's a bit messy but involves no new
>>>> options on require bundle at least.
>>>>
>>>> Regards,
>>>>
>>>> Dave
>>>>
>>>>
>>>>
>>>>>
>>>>> ->    richard
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> I think I've figured out a way to work around it for the time being -
>>>>>> which takes the pressure off from a sigil release point of view. I'll
>>>>>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>>>>>> so I can at least compile against it without dragging in an external
>>>>>> dependency at runtime. The danger with this approach is that unwary
>>>>>> developers may link against a non exported package by mistake. Just
>>>>>> wonder if there is a way to make this work without complicating the
>>>>>> development model (or the sigil code) too much...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> ->      richard
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Dave
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>

Re: Visibility semantics

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/28/09 12:21 PM, David Savage wrote:
> On Tue, Jul 28, 2009 at 3:34 PM, Richard S. Hall<he...@ungoverned.org>  wrote:
>    
>> On 7/28/09 9:47 AM, David Savage wrote:
>>      
>>> On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org>
>>>   wrote:
>>>
>>>        
>>>> On 7/27/09 8:24 AM, David Savage wrote:
>>>>
>>>>          
>>>>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S. Hall<he...@ungoverned.org>
>>>>>   wrote:
>>>>>
>>>>>
>>>>>            
>>>>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> To lay my cards on the table, I kinda like resolve=compile as it dove
>>>>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>>>>> kinda bizarre to be adding another dimension to this whole problem
>>>>>>> when people are worried about the complexity of OSGi. If there is a
>>>>>>> way to do this without exposing developers to it that would be /great/
>>>>>>> but as with OSGi I don't think we should worry about doing the right
>>>>>>> thing at the base layer IDE tools and other schemes can always
>>>>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>>>>> question of what is "right".
>>>>>>>
>>>>>>> So I guess the end result of this email is, what are your thoughts?
>>>>>>>
>>>>>>> * Is resolve=compile a good idea?
>>>>>>> * Should it be resolution=compile?
>>>>>>> * Any other options?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>> Isn't this some form of "uses" constraint? Middle exposes Top because
>>>>>> it
>>>>>> inherits from it, so if you follow transitive "uses" constraints you
>>>>>> could
>>>>>> possibly assume that compile-time access is needed.
>>>>>>
>>>>>>
>>>>>>              
>>>>> Hmmm you're right it certainly resembles uses - should have spotted
>>>>> that myself. However I have a feeling it may get a bit hairy in
>>>>> certain edge cases, i.e. Top may not be in an exported package which
>>>>> could work at runtime I believe, as Middle would provide the class
>>>>> path to Top?
>>>>>
>>>>>
>>>>>            
>>>> I agree, it might not work in every case, but it seems like a good place
>>>> to
>>>> start. It seems in the general case, if a type is exposed, then someone
>>>> must
>>>> have a dependency on it or contain it somewhere in the transitive set of
>>>> dependencies, otherwise it couldn't be exposed...
>>>>
>>>>          
>>> I guess the only concern I have with this approach is making sure it
>>> doesn't get in the way of developers - i.e. the uses should be
>>> calculated by the tooling vs expecting the developers to manage this
>>> manually. Uses is a pretty nasty equation to calculate at runtime and
>>> in an IDE environment where devs are cutting/refactoring code I guess
>>> I'm just wary that it has the possibility to spin out of control and
>>> lock up the IDE. Also should be careful at implementation time to
>>> allow the calculation to be done in such a way as to allow caching so
>>> it doesn't grind the IDE to a halt.
>>>
>>>        
>> I worry about this during framework run time too! :-)
>>
>> That's why we need to devise a decent algorithm that doesn't do this and we
>> can share among our subprojects that require resolving.
>>      
>
> Yep that would certainly be very useful! One of the comments made
> during the sigil contribution was regarding building a resolver API
> that could be reused and implemented in different ways, either for
> research purposes or to allow for different behaviours - fast, logical
> error messages, extended semantics, etc. Maybe we could look at some
> combination of code from Felix, OBR and Sigil to form the basis of an
> API?
>
> The key parts of the sigil resolver (I think) are:
>
> * support for progress notifications (allows for UI analysis of resolutions)
> * pluggable repositories (i.e. sources of bundles - filesystem, obr, etc)
> * support for hierarchical repositories (allows developers to chose
> where they would "prefer" to resolve resources from)
>    

While all of this sounds good, I was more alluding the algorithm 
itself...the API is the easy part if we have an algorithm that is wicked 
fast. :-)

-> richard

> Regards,
>
> Dave
>
>    
>> ->  richard
>>
>>      
>>>>>>> * What to do about fragments?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>> I don't think the fragment issue should be handled, since that is a
>>>>>> bogus
>>>>>> use case for fragments from my point of view. Fragments are intended to
>>>>>> be
>>>>>> optional extensions to the host, but in this case the host is fibbing
>>>>>> about
>>>>>> its contents because it expects to have a fragment attached to it. In
>>>>>> reality, the fragment should have the exports, not the host.
>>>>>>
>>>>>>
>>>>>>              
>>>>> Tend to agree it is a bogus scenario - if only it wasn't happening in
>>>>> one of the most used OSGi libraries available :( I guess Eclipse
>>>>> probably have a good reason for doing this - not sure what but I'll
>>>>> give them the benefit of the doubt.
>>>>>
>>>>>
>>>>>            
>>>> Regardless, it doesn't seem like a good idea to create whole new
>>>> mechanisms
>>>> to support improper use cases.
>>>>
>>>>          
>>> Agree in principle and I certainly want sigil to encourage best
>>> practice OSGi development. But in real world projects the edges are
>>> very rarely clean cut - so we need to provide migration paths at
>>> least. I'll push this out for the time being as I have a work around
>>> for fragments of this type - it's a bit messy but involves no new
>>> options on require bundle at least.
>>>
>>> Regards,
>>>
>>> Dave
>>>
>>>
>>>        
>>>> ->    richard
>>>>
>>>>
>>>>          
>>>>> I think I've figured out a way to work around it for the time being -
>>>>> which takes the pressure off from a sigil release point of view. I'll
>>>>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>>>>> so I can at least compile against it without dragging in an external
>>>>> dependency at runtime. The danger with this approach is that unwary
>>>>> developers may link against a non exported package by mistake. Just
>>>>> wonder if there is a way to make this work without complicating the
>>>>> development model (or the sigil code) too much...
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>>> ->      richard
>>>>>>
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Dave
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>
>>>>>            

Re: Visibility semantics

Posted by David Savage <da...@paremus.com>.
On Tue, Jul 28, 2009 at 3:34 PM, Richard S. Hall<he...@ungoverned.org> wrote:
> On 7/28/09 9:47 AM, David Savage wrote:
>>
>> On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org>
>>  wrote:
>>
>>>
>>> On 7/27/09 8:24 AM, David Savage wrote:
>>>
>>>>
>>>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S. Hall<he...@ungoverned.org>
>>>>  wrote:
>>>>
>>>>
>>>>>
>>>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> To lay my cards on the table, I kinda like resolve=compile as it dove
>>>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>>>> kinda bizarre to be adding another dimension to this whole problem
>>>>>> when people are worried about the complexity of OSGi. If there is a
>>>>>> way to do this without exposing developers to it that would be /great/
>>>>>> but as with OSGi I don't think we should worry about doing the right
>>>>>> thing at the base layer IDE tools and other schemes can always
>>>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>>>> question of what is "right".
>>>>>>
>>>>>> So I guess the end result of this email is, what are your thoughts?
>>>>>>
>>>>>> * Is resolve=compile a good idea?
>>>>>> * Should it be resolution=compile?
>>>>>> * Any other options?
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> Isn't this some form of "uses" constraint? Middle exposes Top because
>>>>> it
>>>>> inherits from it, so if you follow transitive "uses" constraints you
>>>>> could
>>>>> possibly assume that compile-time access is needed.
>>>>>
>>>>>
>>>>
>>>> Hmmm you're right it certainly resembles uses - should have spotted
>>>> that myself. However I have a feeling it may get a bit hairy in
>>>> certain edge cases, i.e. Top may not be in an exported package which
>>>> could work at runtime I believe, as Middle would provide the class
>>>> path to Top?
>>>>
>>>>
>>>
>>> I agree, it might not work in every case, but it seems like a good place
>>> to
>>> start. It seems in the general case, if a type is exposed, then someone
>>> must
>>> have a dependency on it or contain it somewhere in the transitive set of
>>> dependencies, otherwise it couldn't be exposed...
>>>
>>
>> I guess the only concern I have with this approach is making sure it
>> doesn't get in the way of developers - i.e. the uses should be
>> calculated by the tooling vs expecting the developers to manage this
>> manually. Uses is a pretty nasty equation to calculate at runtime and
>> in an IDE environment where devs are cutting/refactoring code I guess
>> I'm just wary that it has the possibility to spin out of control and
>> lock up the IDE. Also should be careful at implementation time to
>> allow the calculation to be done in such a way as to allow caching so
>> it doesn't grind the IDE to a halt.
>>
>
> I worry about this during framework run time too! :-)
>
> That's why we need to devise a decent algorithm that doesn't do this and we
> can share among our subprojects that require resolving.

Yep that would certainly be very useful! One of the comments made
during the sigil contribution was regarding building a resolver API
that could be reused and implemented in different ways, either for
research purposes or to allow for different behaviours - fast, logical
error messages, extended semantics, etc. Maybe we could look at some
combination of code from Felix, OBR and Sigil to form the basis of an
API?

The key parts of the sigil resolver (I think) are:

* support for progress notifications (allows for UI analysis of resolutions)
* pluggable repositories (i.e. sources of bundles - filesystem, obr, etc)
* support for hierarchical repositories (allows developers to chose
where they would "prefer" to resolve resources from)

Regards,

Dave

>
> -> richard
>
>>
>>>>>>
>>>>>> * What to do about fragments?
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> I don't think the fragment issue should be handled, since that is a
>>>>> bogus
>>>>> use case for fragments from my point of view. Fragments are intended to
>>>>> be
>>>>> optional extensions to the host, but in this case the host is fibbing
>>>>> about
>>>>> its contents because it expects to have a fragment attached to it. In
>>>>> reality, the fragment should have the exports, not the host.
>>>>>
>>>>>
>>>>
>>>> Tend to agree it is a bogus scenario - if only it wasn't happening in
>>>> one of the most used OSGi libraries available :( I guess Eclipse
>>>> probably have a good reason for doing this - not sure what but I'll
>>>> give them the benefit of the doubt.
>>>>
>>>>
>>>
>>> Regardless, it doesn't seem like a good idea to create whole new
>>> mechanisms
>>> to support improper use cases.
>>>
>>
>> Agree in principle and I certainly want sigil to encourage best
>> practice OSGi development. But in real world projects the edges are
>> very rarely clean cut - so we need to provide migration paths at
>> least. I'll push this out for the time being as I have a work around
>> for fragments of this type - it's a bit messy but involves no new
>> options on require bundle at least.
>>
>> Regards,
>>
>> Dave
>>
>>
>>>
>>> ->  richard
>>>
>>>
>>>>
>>>> I think I've figured out a way to work around it for the time being -
>>>> which takes the pressure off from a sigil release point of view. I'll
>>>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>>>> so I can at least compile against it without dragging in an external
>>>> dependency at runtime. The danger with this approach is that unwary
>>>> developers may link against a non exported package by mistake. Just
>>>> wonder if there is a way to make this work without complicating the
>>>> development model (or the sigil code) too much...
>>>>
>>>>
>>>>
>>>>>
>>>>> ->    richard
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>

Re: Visibility semantics

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/28/09 9:47 AM, David Savage wrote:
> On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org>  wrote:
>    
>> On 7/27/09 8:24 AM, David Savage wrote:
>>      
>>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S. Hall<he...@ungoverned.org>
>>>   wrote:
>>>
>>>        
>>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>>
>>>>          
>>>>> To lay my cards on the table, I kinda like resolve=compile as it dove
>>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>>> kinda bizarre to be adding another dimension to this whole problem
>>>>> when people are worried about the complexity of OSGi. If there is a
>>>>> way to do this without exposing developers to it that would be /great/
>>>>> but as with OSGi I don't think we should worry about doing the right
>>>>> thing at the base layer IDE tools and other schemes can always
>>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>>> question of what is "right".
>>>>>
>>>>> So I guess the end result of this email is, what are your thoughts?
>>>>>
>>>>> * Is resolve=compile a good idea?
>>>>> * Should it be resolution=compile?
>>>>> * Any other options?
>>>>>
>>>>>
>>>>>            
>>>> Isn't this some form of "uses" constraint? Middle exposes Top because it
>>>> inherits from it, so if you follow transitive "uses" constraints you
>>>> could
>>>> possibly assume that compile-time access is needed.
>>>>
>>>>          
>>> Hmmm you're right it certainly resembles uses - should have spotted
>>> that myself. However I have a feeling it may get a bit hairy in
>>> certain edge cases, i.e. Top may not be in an exported package which
>>> could work at runtime I believe, as Middle would provide the class
>>> path to Top?
>>>
>>>        
>> I agree, it might not work in every case, but it seems like a good place to
>> start. It seems in the general case, if a type is exposed, then someone must
>> have a dependency on it or contain it somewhere in the transitive set of
>> dependencies, otherwise it couldn't be exposed...
>>      
>
> I guess the only concern I have with this approach is making sure it
> doesn't get in the way of developers - i.e. the uses should be
> calculated by the tooling vs expecting the developers to manage this
> manually. Uses is a pretty nasty equation to calculate at runtime and
> in an IDE environment where devs are cutting/refactoring code I guess
> I'm just wary that it has the possibility to spin out of control and
> lock up the IDE. Also should be careful at implementation time to
> allow the calculation to be done in such a way as to allow caching so
> it doesn't grind the IDE to a halt.
>    

I worry about this during framework run time too! :-)

That's why we need to devise a decent algorithm that doesn't do this and 
we can share among our subprojects that require resolving.

-> richard

>    
>>>>> * What to do about fragments?
>>>>>
>>>>>
>>>>>            
>>>> I don't think the fragment issue should be handled, since that is a bogus
>>>> use case for fragments from my point of view. Fragments are intended to
>>>> be
>>>> optional extensions to the host, but in this case the host is fibbing
>>>> about
>>>> its contents because it expects to have a fragment attached to it. In
>>>> reality, the fragment should have the exports, not the host.
>>>>
>>>>          
>>> Tend to agree it is a bogus scenario - if only it wasn't happening in
>>> one of the most used OSGi libraries available :( I guess Eclipse
>>> probably have a good reason for doing this - not sure what but I'll
>>> give them the benefit of the doubt.
>>>
>>>        
>> Regardless, it doesn't seem like a good idea to create whole new mechanisms
>> to support improper use cases.
>>      
>
> Agree in principle and I certainly want sigil to encourage best
> practice OSGi development. But in real world projects the edges are
> very rarely clean cut - so we need to provide migration paths at
> least. I'll push this out for the time being as I have a work around
> for fragments of this type - it's a bit messy but involves no new
> options on require bundle at least.
>
> Regards,
>
> Dave
>
>    
>> ->  richard
>>
>>      
>>> I think I've figured out a way to work around it for the time being -
>>> which takes the pressure off from a sigil release point of view. I'll
>>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>>> so I can at least compile against it without dragging in an external
>>> dependency at runtime. The danger with this approach is that unwary
>>> developers may link against a non exported package by mistake. Just
>>> wonder if there is a way to make this work without complicating the
>>> development model (or the sigil code) too much...
>>>
>>>
>>>        
>>>> ->    richard
>>>>
>>>>
>>>>          
>>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Dave
>>>>>
>>>>>
>>>>>            
>>>
>>>
>>>        

Re: Visibility semantics

Posted by David Savage <da...@paremus.com>.
On Mon, Jul 27, 2009 at 4:03 PM, Richard S. Hall<he...@ungoverned.org> wrote:
> On 7/27/09 8:24 AM, David Savage wrote:
>>
>> On Fri, Jul 24, 2009 at 11:23 PM, Richard S. Hall<he...@ungoverned.org>
>>  wrote:
>>
>>>
>>> On 7/24/09 12:35 PM, David Savage wrote:
>>>
>>>>
>>>> To lay my cards on the table, I kinda like resolve=compile as it dove
>>>> tails kinda neatly with resolution=optional, but equally it seems
>>>> kinda bizarre to be adding another dimension to this whole problem
>>>> when people are worried about the complexity of OSGi. If there is a
>>>> way to do this without exposing developers to it that would be /great/
>>>> but as with OSGi I don't think we should worry about doing the right
>>>> thing at the base layer IDE tools and other schemes can always
>>>> simpilify this whole space down again to joe blogs. I guess it's a
>>>> question of what is "right".
>>>>
>>>> So I guess the end result of this email is, what are your thoughts?
>>>>
>>>> * Is resolve=compile a good idea?
>>>> * Should it be resolution=compile?
>>>> * Any other options?
>>>>
>>>>
>>>
>>> Isn't this some form of "uses" constraint? Middle exposes Top because it
>>> inherits from it, so if you follow transitive "uses" constraints you
>>> could
>>> possibly assume that compile-time access is needed.
>>>
>>
>> Hmmm you're right it certainly resembles uses - should have spotted
>> that myself. However I have a feeling it may get a bit hairy in
>> certain edge cases, i.e. Top may not be in an exported package which
>> could work at runtime I believe, as Middle would provide the class
>> path to Top?
>>
>
> I agree, it might not work in every case, but it seems like a good place to
> start. It seems in the general case, if a type is exposed, then someone must
> have a dependency on it or contain it somewhere in the transitive set of
> dependencies, otherwise it couldn't be exposed...

I guess the only concern I have with this approach is making sure it
doesn't get in the way of developers - i.e. the uses should be
calculated by the tooling vs expecting the developers to manage this
manually. Uses is a pretty nasty equation to calculate at runtime and
in an IDE environment where devs are cutting/refactoring code I guess
I'm just wary that it has the possibility to spin out of control and
lock up the IDE. Also should be careful at implementation time to
allow the calculation to be done in such a way as to allow caching so
it doesn't grind the IDE to a halt.

>
>>>> * What to do about fragments?
>>>>
>>>>
>>>
>>> I don't think the fragment issue should be handled, since that is a bogus
>>> use case for fragments from my point of view. Fragments are intended to
>>> be
>>> optional extensions to the host, but in this case the host is fibbing
>>> about
>>> its contents because it expects to have a fragment attached to it. In
>>> reality, the fragment should have the exports, not the host.
>>>
>>
>> Tend to agree it is a bogus scenario - if only it wasn't happening in
>> one of the most used OSGi libraries available :( I guess Eclipse
>> probably have a good reason for doing this - not sure what but I'll
>> give them the benefit of the doubt.
>>
>
> Regardless, it doesn't seem like a good idea to create whole new mechanisms
> to support improper use cases.

Agree in principle and I certainly want sigil to encourage best
practice OSGi development. But in real world projects the edges are
very rarely clean cut - so we need to provide migration paths at
least. I'll push this out for the time being as I have a work around
for fragments of this type - it's a bit messy but involves no new
options on require bundle at least.

Regards,

Dave

>
> -> richard
>
>> I think I've figured out a way to work around it for the time being -
>> which takes the pressure off from a sigil release point of view. I'll
>> add the fragment to the ordinary classpath vs the OSGi filtered one,
>> so I can at least compile against it without dragging in an external
>> dependency at runtime. The danger with this approach is that unwary
>> developers may link against a non exported package by mistake. Just
>> wonder if there is a way to make this work without complicating the
>> development model (or the sigil code) too much...
>>
>>
>>>
>>> ->  richard
>>>
>>>
>>>>
>>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>>
>>>> Regards,
>>>>
>>>> Dave
>>>>
>>>>
>>
>>
>>
>>
>

Re: Visibility semantics

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/27/09 8:24 AM, David Savage wrote:
> On Fri, Jul 24, 2009 at 11:23 PM, Richard S. Hall<he...@ungoverned.org>  wrote:
>    
>> On 7/24/09 12:35 PM, David Savage wrote:
>>      
>>> To lay my cards on the table, I kinda like resolve=compile as it dove
>>> tails kinda neatly with resolution=optional, but equally it seems
>>> kinda bizarre to be adding another dimension to this whole problem
>>> when people are worried about the complexity of OSGi. If there is a
>>> way to do this without exposing developers to it that would be /great/
>>> but as with OSGi I don't think we should worry about doing the right
>>> thing at the base layer IDE tools and other schemes can always
>>> simpilify this whole space down again to joe blogs. I guess it's a
>>> question of what is "right".
>>>
>>> So I guess the end result of this email is, what are your thoughts?
>>>
>>> * Is resolve=compile a good idea?
>>> * Should it be resolution=compile?
>>> * Any other options?
>>>
>>>        
>> Isn't this some form of "uses" constraint? Middle exposes Top because it
>> inherits from it, so if you follow transitive "uses" constraints you could
>> possibly assume that compile-time access is needed.
>>      
>
> Hmmm you're right it certainly resembles uses - should have spotted
> that myself. However I have a feeling it may get a bit hairy in
> certain edge cases, i.e. Top may not be in an exported package which
> could work at runtime I believe, as Middle would provide the class
> path to Top?
>    

I agree, it might not work in every case, but it seems like a good place 
to start. It seems in the general case, if a type is exposed, then 
someone must have a dependency on it or contain it somewhere in the 
transitive set of dependencies, otherwise it couldn't be exposed...

>>> * What to do about fragments?
>>>
>>>        
>> I don't think the fragment issue should be handled, since that is a bogus
>> use case for fragments from my point of view. Fragments are intended to be
>> optional extensions to the host, but in this case the host is fibbing about
>> its contents because it expects to have a fragment attached to it. In
>> reality, the fragment should have the exports, not the host.
>>      
>
> Tend to agree it is a bogus scenario - if only it wasn't happening in
> one of the most used OSGi libraries available :( I guess Eclipse
> probably have a good reason for doing this - not sure what but I'll
> give them the benefit of the doubt.
>    

Regardless, it doesn't seem like a good idea to create whole new 
mechanisms to support improper use cases.

-> richard

> I think I've figured out a way to work around it for the time being -
> which takes the pressure off from a sigil release point of view. I'll
> add the fragment to the ordinary classpath vs the OSGi filtered one,
> so I can at least compile against it without dragging in an external
> dependency at runtime. The danger with this approach is that unwary
> developers may link against a non exported package by mistake. Just
> wonder if there is a way to make this work without complicating the
> development model (or the sigil code) too much...
>
>    
>> ->  richard
>>
>>      
>>> * Is anyone still there (i.e. has this email lost you all?)?
>>>
>>> Regards,
>>>
>>> Dave
>>>
>>>        
>
>
>
>    

Re: Visibility semantics

Posted by David Savage <da...@paremus.com>.
On Fri, Jul 24, 2009 at 11:23 PM, Richard S. Hall<he...@ungoverned.org> wrote:
> On 7/24/09 12:35 PM, David Savage wrote:
>>
>> To lay my cards on the table, I kinda like resolve=compile as it dove
>> tails kinda neatly with resolution=optional, but equally it seems
>> kinda bizarre to be adding another dimension to this whole problem
>> when people are worried about the complexity of OSGi. If there is a
>> way to do this without exposing developers to it that would be /great/
>> but as with OSGi I don't think we should worry about doing the right
>> thing at the base layer IDE tools and other schemes can always
>> simpilify this whole space down again to joe blogs. I guess it's a
>> question of what is "right".
>>
>> So I guess the end result of this email is, what are your thoughts?
>>
>> * Is resolve=compile a good idea?
>> * Should it be resolution=compile?
>> * Any other options?
>>
>
> Isn't this some form of "uses" constraint? Middle exposes Top because it
> inherits from it, so if you follow transitive "uses" constraints you could
> possibly assume that compile-time access is needed.

Hmmm you're right it certainly resembles uses - should have spotted
that myself. However I have a feeling it may get a bit hairy in
certain edge cases, i.e. Top may not be in an exported package which
could work at runtime I believe, as Middle would provide the class
path to Top?

>
>> * What to do about fragments?
>>
>
> I don't think the fragment issue should be handled, since that is a bogus
> use case for fragments from my point of view. Fragments are intended to be
> optional extensions to the host, but in this case the host is fibbing about
> its contents because it expects to have a fragment attached to it. In
> reality, the fragment should have the exports, not the host.

Tend to agree it is a bogus scenario - if only it wasn't happening in
one of the most used OSGi libraries available :( I guess Eclipse
probably have a good reason for doing this - not sure what but I'll
give them the benefit of the doubt.

I think I've figured out a way to work around it for the time being -
which takes the pressure off from a sigil release point of view. I'll
add the fragment to the ordinary classpath vs the OSGi filtered one,
so I can at least compile against it without dragging in an external
dependency at runtime. The danger with this approach is that unwary
developers may link against a non exported package by mistake. Just
wonder if there is a way to make this work without complicating the
development model (or the sigil code) too much...

>
> -> richard
>
>> * Is anyone still there (i.e. has this email lost you all?)?
>>
>> Regards,
>>
>> Dave
>>
>



-- 
-------------------------------------------------------------------------------------

Paremus Limited. Registered in England. Registration No. 4181472

Registered Office: 22-24 Broad Street, Wokingham, Berks RG40 1BA

Postal Address: 107-111 Fleet Street, London, EC4A 2AB

The information transmitted is intended only for the person(s) or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of, or taking of any action in reliance upon, this
information by persons or entities other than the intended recipient
is prohibited.

If you received this in error, please contact the sender and delete
the material from any computer.

-------------------------------------------------------------------------------------

Re: Visibility semantics

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/24/09 12:35 PM, David Savage wrote:
> To lay my cards on the table, I kinda like resolve=compile as it dove
> tails kinda neatly with resolution=optional, but equally it seems
> kinda bizarre to be adding another dimension to this whole problem
> when people are worried about the complexity of OSGi. If there is a
> way to do this without exposing developers to it that would be /great/
> but as with OSGi I don't think we should worry about doing the right
> thing at the base layer IDE tools and other schemes can always
> simpilify this whole space down again to joe blogs. I guess it's a
> question of what is "right".
>
> So I guess the end result of this email is, what are your thoughts?
>
> * Is resolve=compile a good idea?
> * Should it be resolution=compile?
> * Any other options?
>    

Isn't this some form of "uses" constraint? Middle exposes Top because it 
inherits from it, so if you follow transitive "uses" constraints you 
could possibly assume that compile-time access is needed.

> * What to do about fragments?
>    

I don't think the fragment issue should be handled, since that is a 
bogus use case for fragments from my point of view. Fragments are 
intended to be optional extensions to the host, but in this case the 
host is fibbing about its contents because it expects to have a fragment 
attached to it. In reality, the fragment should have the exports, not 
the host.

-> richard

> * Is anyone still there (i.e. has this email lost you all?)?
>
> Regards,
>
> Dave
>