clojure.lib suggestion #1: prefer str-utils2

9 views
Skip to first unread message

Stuart Halloway

unread,
Jan 25, 2010, 8:04:26 AM1/25/10
to cloju...@googlegroups.com
(1) I propose that clojure.contrib.str-utils2 be preferred over str-
utils for inclusion in clojure.lib.

(2) Further, I propose that we bless str-utils2's approach to naming
as Official Good Clojure Style. That is: "Prefer good, short names.
Fear not conflicts, nay even with core. Prefer require/as or use/only
over blanket use."

For more discussion on this see Stuart's original thread at [1]

Stu

[1] http://groups.google.com/group/clojure/browse_thread/thread/ca0101f09147fce4/93f17a736772d3bb?lnk=gst&q=string+library+ready#93f17a736772d3bb

Sean Devlin

unread,
Jan 25, 2010, 9:39:19 AM1/25/10
to Clojure Dev
I'd like to request a change to str-utils2 before including it in
core. At the time of the writing, ->> wasn't an option. Now that it
is, could str-utils2 be written to favor ->>, not ->? I see the
following benefits:

1. Allows expression threading and point free styles at the same
time.
2. Makes is easier for noobs to learn. This way c.c.s/take has the
same signature as core/take. This way there's nothing else to
explain.

Thoughts?
Sean

On Jan 25, 8:04 am, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
> (1) I propose that clojure.contrib.str-utils2 be preferred over str-
> utils for inclusion in clojure.lib.
>
> (2) Further, I propose that we bless str-utils2's  approach to naming  
> as Official Good Clojure Style. That is: "Prefer good, short names.  
> Fear not conflicts, nay even with core. Prefer require/as or use/only  
> over blanket use."
>
> For more discussion on this see Stuart's original thread at [1]
>
> Stu
>

> [1]http://groups.google.com/group/clojure/browse_thread/thread/ca0101f09...

Stuart Sierra

unread,
Jan 25, 2010, 10:09:45 AM1/25/10
to Clojure Dev
On Jan 25, 9:39 am, Sean Devlin <francoisdev...@gmail.com> wrote:
> 2.  Makes is easier for noobs to learn.  This way c.c.s/take has the
> same signature as core/take.  This way there's nothing else to
> explain.

Not having the arg signatures match the corresponding sequence
functions was definitely a mistake.

Now that ->> exists, I'm willing to rewrite in most-significant-arg-
last style.

-SS

Perry Trolard

unread,
Jan 25, 2010, 10:28:06 AM1/25/10
to Clojure Dev
+ 1 to everything here: prefering str-utils2 with rearranged
signatures, & holding its naming up as exemplary.

Perry

Laurent PETIT

unread,
Jan 26, 2010, 1:45:37 AM1/26/10
to cloju...@googlegroups.com
If nobody minds the breaking change, I'd say go for it!

2010/1/25 Sean Devlin <francoi...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
> To post to this group, send email to cloju...@googlegroups.com.
> To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.
>
>

Tom Hickey

unread,
Feb 2, 2010, 4:14:35 PM2/2/10
to Clojure Dev
Forgive me for being a little late to the party on this one...

I was glad to see str-utils2 being included for promotion in
clojure.lib, but am in preference of str-utils2 favoring of -> over -
>>

Rich's comment here [1] has me wondering if maybe the decision to
promote the (rather new) str-utils3 (now c.c.string) style should be
reconsidered. (Perhaps I am misconstruing his point as it applies
here, or perhaps I just need more time to get used to new style)

Cheers,
Tom

[1] http://groups.google.com/group/clojure-dev/msg/36cfb1f43eb0e1d2

Sean Devlin

unread,
Feb 2, 2010, 4:22:14 PM2/2/10
to cloju...@googlegroups.com
Does str-utils fit the definition of sequence fns or collection fns better?  Do you chain them a lot?


--

Tom Hickey

unread,
Feb 2, 2010, 5:48:29 PM2/2/10
to Clojure Dev
Okay, I guess didn't quite have my feet wet enough with ->>, but after
seeing more examples ([1] & [2]) I see more the gains of "playing well
with sequence functions" for c.c.string. I guess my experience with
chaining strings was mostly with chaining other string functions.

[1] http://clojure-log.n01se.net/date/2009-10-16.html
[2] http://clojure-log.n01se.net/date/2009-10-28.html

> > clojure-dev...@googlegroups.com<clojure-dev%2Bunsubscribe@googlegr oups.com>

Reply all
Reply to author
Forward
0 new messages