Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commentary on Syntax #1

Open
qpfiffer opened this issue Dec 28, 2015 · 3 comments
Open

Commentary on Syntax #1

qpfiffer opened this issue Dec 28, 2015 · 3 comments

Comments

@qpfiffer
Copy link
Member

Mostly just thoughts and stuff on the various sections:

Conditionals

  • Any plan for things like <= or <=?
  • Logical conjunction operators like || and &&?

Functions and Conditions

function param1 param2
  ? = (+ param1 param2) 10
    : True
  : False

I dislike the parens here. I feel like the language has made it this far without them, and could instead be incorporated with the ! syntax, much like Haskell's $. So the function could thus become:

function param1 param2
  ? = ! + param1 param2 10
    : True
  : False

The + operator would end up chewing up param1 and param2, leaving the result and 10 to be compared.

Classes and Methods

This is one thing thats always been a little hazy for me. In the following examples:

Numbers val1 val2
  add
    : + val1 val2
  sub
    : - val1 val2
  isEven
    : = %2 0

Are val1 and val2 persistent across instances of this class? I usually view these things as something more akin to namespaces, which I'm not sure is what you're going for. I'd rather instead see something like:

Numbers
  add  val1 val2
    : + val1 val2
  sub  val1 val2
    : - val1 val2
  isEven
    : = %2 0

I guess from the syntax it's clear that these values are stored inside the instance. I don't really care either way on this one.

Loops, foreach and while

This is just something I'd like clarification on:

index : 0
loop
  ? = index 10 : True
  + = index 1

loop
  ? = index 10
    : True
  + = index 1
  : loop

Are these two functions equivalent? From an implementation perspective it would be very simple to assume all functions always implicitly recurse.

@neauoire
Copy link
Member

Conditionals

Any plan for things like <= or <=? Logical conjunction operators like || and &&?
I haven't thought about it too much, but I don't see why not.

Functions

I dislike the parens here. I feel like the language has made it this far without them, and could instead be incorporated with the ! syntax.

Absolutely, I will update the draft. Only issue is that the + operator can have a variable number of parameters and and it blurs the line as to where this stops, we will need a way to wrap inline declarations.

Classes and Methods

This is one thing thats always been a little hazy for me.

The example was bad, I suppose this is more an issue with scope. I was thinking that capitalized values are accessible from deeper levels.

func 
  Foo : 5
  func
    : Foo

! func.func // 5

Loops, foreach and while

All functions always implicitly recurse.

@qpfiffer
Copy link
Member Author

Could we get a different symbol for comment blocks vs. line comments? Having the same symbol makes for ambiguous situations

@neauoire
Copy link
Member

Do you like

{some comment}

and

{
line1
line2
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants