Would there be interest in a forward-slash operator on String as a shortcut
for File.join? I end up using File.join everywhere and it seems like
something so fundamental could benefit from an operator. For instance:
File.join('Documents', 'projects', 'ruby', 'string.c')
would become:
'Documents' / 'projects' / 'ruby' / 'string.c'
Thoughts?
···
--
*Kevin D. Deisz*
Localytics Software Engineer
The Homebrew package manager for OS X does just that. I haven't looked at
how it's implemented, but it's probably simple if you don't mind
monkey-patching String.
I assume you meant as a built-in language feature, though. My opinion on
that is that it would be nice to have, but it conflates the concepts of
strings and pathname components in a way that isn't really justified.
Perhaps if there were an actual pathname component data type (and
corresponding literal syntax).
···
On Thu, Jul 7, 2016 at 11:30 AM, Kevin Deisz <kevin.deisz@gmail.com> wrote:
Would there be interest in a forward-slash operator on String as a
shortcut for File.join? I end up using File.join everywhere and it seems
like something so fundamental could benefit from an operator. For instance:
File.join('Documents', 'projects', 'ruby', 'string.c')
would become:
'Documents' / 'projects' / 'ruby' / 'string.c'
Thoughts?