On 20 ον, 16:54, Christopher Dicely <cmdic... / gmail.com> wrote:
> 2011/6/17 Ilias Lazaridis <il... / lazaridis.com>:
>
> > On 17 ον, 21:17, Gary Wright <gwtm... / mac.com> wrote:
> >> I can't believe I'm adding to this conversation...
>
> >> Ruby already has an idiom for naming two related methods so how about:
>
> >> require "a/b"    # the usual
> >> require! "a/b"    # require relative to __FILE__
>
> > This could become my new favourite.
>
> > "!" is used as a convention, to clarify that a method "modifies the
> > object"
>
> This misstates the existing convention; see below.

ok

> > "!" could be used for stand-alone functions (e.g. the "flat" Kernel
> > functions which do not operate strictly on an object) to clarify (by
> > convention) "you should know what you do, possible risks" or simply
> > "alternate implementation".
>
> This second thing is actually the current convention for "!" for
> normal methods (e.g., not just "flat" Kernel functions.): "!"
> indicates a more-dangerous alternative when the base name is already
> used.

Which would mean the rule apply, and the question is:

Is "require_relative" more dangerous than "require", thus "require!"
would fit the naming-convention?

I say:

yes, because you can include everything from your source-tree, where
"require" loads only from predefined paths.

> It doesn't always indicate a mutating method, and mutating
> methods don't always have it.

ok

> OTOH, require_relative is much more clear as to what it is doing than
> require! would be, amd.

This is not the topic.

> anyway, require! is 8 characters, not 7.

The requirement "7 chars" was an optional one.

.

--
http://lazaridis.com