Giter VIP home page Giter VIP logo

Comments (4)

JalonSolov avatar JalonSolov commented on June 20, 2024 1

No, you are correct, you have just run into a bug.

from v.

GGRei avatar GGRei commented on June 20, 2024

@pd-giz-dave because you assign at the labels var in your function a struct that does not exist ( struct assignation declaration in your example ) and you trying to return it. Moreover, return type of your function is not a struct.

It's not a bug.

from v.

pd-giz-dave avatar pd-giz-dave commented on June 20, 2024

The type alias documentation is this:
"Type aliases
To define a new type NewType as an alias for ExistingType, do type NewType = ExistingType.
This is a special case of a sum type declaration."
So is "[][]int" not a type?
I'm a newbie to V so I niaively interpreted a type alias like a C #define, ie. anywhere where ExistingType is valid so would NewType be.
My understanding is clearly wrong, but a fuller explanation in the docs would help.

from v.

felipensp avatar felipensp commented on June 20, 2024

If we change array to map on Labels, we'll get:

bug.v:7:16: error: direct map alias init is not possible, use Labels(map[int]string{}) instead

So, if we want to support array init via this struct way, probably we should support map too for consistency.

from v.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.