The Crystal Programming Language Forum

Does Rails have some influence on the development of Crystal?

I just saw a comment on issue #9411 in which a core member rejected the idea of having a method with the same name as one in Rails but with different semantics, to avoid confusion.

I know that a foundational goal of Crystal was to have a syntax like that of Ruby, but it comes as a surprise that Rails would also guide a decision.

I am asking whether Rails has some influence on Crystal. Or am I mistaken?

I just want to understand more of Crystal :)

There are two disadvantages to reusing that name:

  • if we do it like Rails, it’s just a small alias to gsub('_', '-') which for me doesn’t make sense in the standard library. A shard is better suited for this, probably a shard related to web-something (I don’t know why dashes would be needed instead of underscores for, supposedly, identifiers).
  • if we don’t do it like Rails, it’s not clear what the beahvior is

We don’t copy Rails or anything else, but we look around and see what others are doing to see if we can do better, or just do the same as others.

5 Likes

Thank you for responding.

I understood your comment on the issue. I was wondering on the mention of Rails.

As for your last remark, I was not wondering if Crystal copies from Rails, but rather if it derives some ideas, as you said.

Maybe it was a redundant question, but it’s been clarified now :+1:

As a small opinion, I would not consider a straight up copy to be a bad thing or something like that. (def|class|module) ... end, @-prefixed instance variables and other constructs are copies of Ruby or some ascendant of it, and with good reason given the elegance of the notation.

if it derives some ideas

The only thing we “copied” from Rails, actually ActiveSupport, were underscore, camelcase and blank?. Maybe in_group_of of Enumerable. These are generally useful methods so they are there.

There’s nothing else that we copied from Rails, and we don’t take inspiration from Rails because it’s a web framework and Crystal’s std in general-purpose.

1 Like