← Back to team overview

ooc-dev team mailing list archive

Re: [ooc-dev] "Implicit As"

 

Hi,

So implicit as has been implemented, and is allowed only on extern
functions, which pretty  much answers showstopper's request I guess.

And no we can't use an 's' to 's data' transformation. In my new
experimental sdk, I use a 'bytes' properties that accesses an abstract
'getBytes()' method declared like this:

    bytes: Byte* {
        get { _getBytes() }
    }

    /** return the contents of this String, as an array of bytes, UTF-8
encoded */
    _getBytes: abstract func -> Byte*

I think it's pretty neat, if you ask me.

ndd

On Sun, Aug 8, 2010 at 1:36 AM, Friedrich Weber <
fred.reichbier@xxxxxxxxxxxxxx> wrote:

> Hi there,
>
> can we think of any *nice* use-cases for implicit as besides the
> String-Char* thing? If yes, IMO we should allow it and make it accessible to
> the user, if no, we should add a special case in the compiler only handling
> String/Char*.
>
> Another issue: Can we really just use a `s` to `s data` transformation?
> Will `String` have a simple `data` attribute that can be used when passing
> instances to C functions? (I'm no unicodeguru, so I might be very very
> wrong, please correct me) For example, if we're going to store Strings as an
> array of 2-byte values (kind of UTF-16?), we can't just pass this
> `uint16_t*` to extern C functions, but we'd rather need to convert it to a
> simple Char* containing UTF-8 first -- right? We couldn't just replace `s`
> with `s data` then, rather with `convertToUTF8(s data)`.
>
> I hope my point is clear somehow a bit.
>
> Cheers,
>
> Friedrich
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ooc-dev
> Post to     : ooc-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ooc-dev
> More help   : https://help.launchpad.net/ListHelp
>

References