namgk / ambienttalk

Automatically exported from code.google.com/p/ambienttalk
0 stars 0 forks source link

when:discovered: handler should be extended to get access to the concrete discovered type #40

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Limitation in when:discovered: handler discovered by Tomohiro Suzuki:

when using when:discovered: to discover a generic type, the handler cannot 
access the actual type of the discovered service. For example:

{{{
when: Type discovered: { |service|
  // how to get access to the actual type under which service was exported?
  // can be any subtype of 'Type'
}
}}}

We cannot easily pass this type as a second argument to the handler, since this 
would make all existing when:discovered: handlers crash. Suggested solution is 
to add a new primitive:

{{{
when: Type discoveredAs: { |service, realType|
  // realType refers to the exported type tag, for which it holds that:
  // realType.isSubtypeOf(Type)
}
}}}

Original issue reported on code.google.com by tvcut...@gmail.com on 23 Jun 2010 at 8:06

GoogleCodeExporter commented 8 years ago
Currently doesn't work for local far references, but remote farrefs can use 
tagsOf: ...

Original comment by Botje.linux@gmail.com on 24 May 2013 at 1:44