On 20 Jun 2011, at 17:57, Reto Bachmann-Gmuer wrote:
> Hi Henry
>
> I'm trying to add some test for the implicit conversions (A separate
> test-file so it doesn't interfere with the one you're writing) and I'm unable
> to get implicit conversion for the apply-methods, did you ever succeed using
> them?
>
> zz>"hello"('en)
> "hello"('en)
> <console>:38: error: type mismatch;
> found : java.lang.String
> required: ?{val apply: ?}
> Note that implicit conversions are not applicable because they are ambiguous:
> both method string2lit in object EasyGraph of type (str:
> String)org.apache.clerezza.rdf.scala.utils.PlainLiteralScala
> and method augmentString in object Predef of type (x:
> String)scala.collection.immutable.StringOps
> are possible conversion functions from java.lang.String to ?{val apply: ?}
> "hello"(en)
I don't think I used them. I was thinking originally of creating vals (or
whatever the right system would be) for each of the languages so that one could
just write "hello"(en). I think I only have a few languages I created constants
for as an idea to be developed. This was before I knew about 'en notation.
Having constants has the advantage of type safety: the compiler could easily
check for misspelled languages. 'en does not allow this to be verified by the
compiler. On the other hand it is more work to write out all the languages.
The signature for apply would be something like
def apply(lang: Lang)
or something like that.
Henry
>
> Cheers,
> Reto
Social Web Architect
http://bblfish.net/