Git Product home page Git Product logo

Comments (5)

graydude avatar graydude commented on June 5, 2024

Looks good, but where would you define the arguments for tgis function? Or is it: no statement, no arguments? In that case, how do we separate (arguments) and (body) if they both use ()'s?

Sent via Hubroid

from -g-pl.

graydude avatar graydude commented on June 5, 2024

Nevermind that, I just saw that the draft says function{}(). I'm used to it being the other way around, I like it.

Sent via Hubroid

from -g-pl.

haasn avatar haasn commented on June 5, 2024

I have not worked lists into the spec yet but once they're in, it will be something like

>implying OP isn't >function{args} (
    >mfw >len args
    >mfw args[0]
)

Of course, if you can find a way to make this more /g/ related, I'm open to suggestions.

from -g-pl.

haasn avatar haasn commented on June 5, 2024

The reasoning why I swapped them, {} and (), is because the () is not just used for functions. () is used for all blocks and can be omitted if not needed.

For example, a function which only performs a single statement could look like:

>implying foo isn't >function{x} >mfw x

That being said, one potentially confusing thing could be the fact that () denotes blocks (which are statements), but statements are not expressions, so an unfamiliar user could accidentally try something like >mul 3 (>add 2 5) which is of course illegal. We could also swap them, as this would probably get rid of this ambiguity (and free up parentheses for other tasks, eg. grouping math if we're going to add infix operators)

If we swapped them, functions would look a bit more familiar:

>implying OP isn't >function(args) {
    >mfw args[0]
}

I'll leave this up for debate.

Ps. I added you to the contributors list so you can push commits to this repository directly.

from -g-pl.

haasn avatar haasn commented on June 5, 2024

I've swapped them around for now, since it probably does make more sense this way.

from -g-pl.

Related Issues (17)

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.