slash-lang / slash

A new language for the web
http://slash-lang.org
MIT License
386 stars 22 forks source link

split default keyword argument not working #31

Closed zzak closed 10 years ago

zzak commented 10 years ago

making a note, i will check on this later if noone else gets to it:

def foo {
  "zomg split already".split();
}

results with: ArgumentError: Too few arguments. Expected 1, received 0.

to work around this i can do the following:

def foo {
  "zomg ok this works".split(" ");
}
haileys commented 10 years ago

String#split doesn't currently take a default argument

zzak commented 10 years ago

@charliesome the doc says #split(delimiter = " ")

haileys commented 10 years ago

@zzak oh lol, that's a doc bug. Those docs need to be thrown out.

zzak commented 10 years ago

@charliesome so spec would be no default delimiter?

i can send a patch to update the docs, i was guessing the docs were reflecting spec.

thanks!

haileys commented 10 years ago

@zzak At the moment there's most certainly no default delimiter, although I intend to add it in the future. Still, it shouldn't be in the docs at this point.

vstm commented 10 years ago

@charliesome Should I fix the docs? On the other hand it would be cool to have a default value for delimiter - in that case: is " " a good default value? I'd be happy to provide a fix for this issue.

haileys commented 10 years ago

@vstm If you could open a PR that fixes the default value, that'd be most appreciated!