Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: union member already defined?


On Mon, 30 Jul 2018 21:48:07 -0700, iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> I don't really mind typing "std." but the way Rust deals with this is by
> implicitly putting "use std::option::Option::{Some,None};" along with some
> other conveniences into every module. If we supported bringing things into
> scope that way, we could also include similarly fundamental things (mk? slice
> operations?) in our prelude.
> 
> Names tend to be shorter in Myrddin though, so the need might not be there.

For a while, I also had a patch in that used D's resolution rules: If a name
was unambiguous, it could be grabbed from any scope. If it was ambiguous,
it would need to be fully qualified. So, for example, if you had the following
packages:

    pkg foo =
         const Count = 123
    ;;

    pkg bar =
        const Count = 246
    ;;

This code would be fine:

    use foo
    const main = {; frob(Count)}

But this code would not:

    use foo
    use bar
    const main = {; frob(Count)}

You'd need to amend to:

    use foo
    use bar
    const main = {; frob(foo.Count)}

It sounds nice, but the feedback ended up being that the explicitness was
only mildly annoying for the writer, and useful for the reader.

I'm ok with the state of things as it is.

-- 
    Ori Bernstein

References:
union member already defined?theos <theosjp@xxxxxxxxx>
Re: union member already defined?iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Re: union member already defined?theos <theosjp@xxxxxxxxx>
Re: union member already defined?Ori Bernstein <ori@xxxxxxxxxxxxxx>
Re: union member already defined?Ryan Gonzalez <rymg19@xxxxxxxxx>
Re: union member already defined?iriri <iri@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>