incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reto Bachmann-Gmuer <r...@apache.org>
Subject Re: apply-method for language
Date Tue, 21 Jun 2011 06:23:50 GMT
On Tue, Jun 21, 2011 at 12:45 AM, Henry Story <henry.story@bblfish.net>wrote:

>
> 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.
>
I know how the apply method works. However as the object you're adding it to
is designed to be created via implicit conversion from String this won't
work as there is a concurring implicit rule in PreDef, for this it makes no
difference on whether the argument is String, Symbol or Language.

Do you think you have some time today to demonstrate how things work in the
unit tests? Afaict the examples you wrote in the comments, e.g. the one with
(FOAF.knows)(g.bnode(FOAF.name)("Danny Ayers"('en))) cannot work.

Reto



> Henry
>
>
>
>
> Cheers,
> Reto
>
>
> Social Web Architect
> http://bblfish.net/
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message