Skip to content

Conversation

dunkelziffer
Copy link

I had an idea to add the possibility to introduce method signatures with a notation inspired by Sorbet. It allows specifying partial method signatures. It only cares about arguments, not about the return value.

Feel free to close this PR if you don't like this feature. I wrote this code as a draft and it's probably not very robust, yet. It was mostly a fun experiment during a train ride to see, how difficult this would be to do.

@dunkelziffer dunkelziffer marked this pull request as draft September 8, 2025 21:06
@dunkelziffer
Copy link
Author

Alternative syntax proposal to make it look more like prop from Literal::Properties:

sig :c, Integer
sig :f, String
def m(a, b = 1, *c, d:, e: 2, **f)
  puts 'works'
end

@joeldrapper
Copy link
Collaborator

Thanks for your PR. I enjoyed meeting you and discussing this in person. 😄

I think let’s not add this directly to Literal, but it makes sense as an extension that can use Literal’s type system.

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

Successfully merging this pull request may close these issues.

2 participants