Re:Open-sourcing Sorbet: a fast, powerful type checker for Ruby
by hartator on Thursday June 20, 2019 @03:47PM
(#20236624)
> We used `params` because Method#parameters was what they called it in the standard library
Super interesting. We should probably have being consistent for naming parameters vs. arguments in stdlib. It's too late though!
Re:Open-sourcing Sorbet: a fast, powerful type checker for Ruby
by steveklabnik on Thursday June 20, 2019 @03:59PM
(#20236733)
On a super pedantic level, "parameters" are the names that you write in the function definition, and "arguments" are the values you pass as parameters.
def name_length(person)
steve = Person.new
name_length(steve)
Here, 'person' is a parameter, and 'steve' is an argument.Most programmers use them interchangeably.
Re:Open-sourcing Sorbet: a fast, powerful type checker for Ruby
by learc83 on Thursday June 20, 2019 @04:07PM
(#20236804)
We called those 2 terms "formal parameters", and "actual parameters" if I remember my programming language concepts class from college correctly.
Re:Open-sourcing Sorbet: a fast, powerful type checker for Ruby
by sdegutis on Thursday June 20, 2019 @04:21PM
(#20236931)
I've never been to programming college but in 10 years I have always heard them as def(parameters) and call(arguments). Probably a lot of that was when reading about how VMs and compilers work, though.
We used `params` because Method#parameters was what they called it in the standard library. I actually had it as `args` originally until someone pointed this out. https://ruby-doc.org/core-2.6.3/Method.html#method-i-paramet...
As for the syntax change, we are actually on our 8th iteration of the syntax. We really wanted this to NOT be a fork of Ruby so finding something compatible was very important. For example that's why it has the weird `sig {` syntax too, we didn't want to have to cause load-time and cyclic dependencies from adding type signatures.