exists? is a pretty critical feature for application writers and I asked several users about it before committing to a name. Unless Clojure decides to adopt it, little incentive to cause unnecessary breakage.
David On Fri, Feb 14, 2014 at 10:28 PM, Joel Holdbrooks <cjholdbro...@gmail.com>wrote: > Slightly off topic, but I wish I would have been apart of that discussion > because there's another example of function that, at face value, doesn't > clearly express it's nature. In tandem with my comment below, there should > really be a little more consideration for the names of these functions. I > would agree that short function names should be favored but not at the > expense of communication. > > There's probably nothing that can be done for this now, but while feature > detection is common *in a program*, it is uncommon *throughout a program*. > I would thus argue, that a name with a higher degree of precision, and > perhaps more characters, would have been a better choice. > > On Friday, February 14, 2014 2:36:51 PM UTC-8, David Nolen wrote: > >> exists? doesn't seem right to me. Also we do use `exists?` currently in >> ClojureScript since feature detection is so common in client side code and >> the name seems more appropriate to me in that context. That could of course >> change but we would need to coordinate. >> >> David >> >> >> On Fri, Feb 14, 2014 at 3:27 PM, Dom Kiva-Meyer <li...@domkm.com> wrote: >> >>> Great changes! I have a question about #5. >>> >>> >>>> 5) New "some" operations >>>> Many conditional functions rely on logical truth (where "falsey" >>>> values are nil or false). Sometimes it is useful to have functions >>>> that rely on "not nilness" instead. These functions have been added to >>>> support these cases [CLJ-1343]: >>>> * some? - same as (not (nil? x)) >>>> * if-some - like if-let, but checks (not (nil? test)) instead of test >>>> * when-some - like when-let, but checks (not (nil? test)) instead of >>>> test >>> >>> >>> It seems inconsistent to have "some" mean two very different things >>> within the same namespace, especially since the prior uses of "some" >>> (`some`, `some-fn`, etc.) are more in keeping with its primary definition >>> of having to do with amount (and operate on seqs or variadic arguments) >>> while the new functions have to do with existence (and operate on any >>> single value). Why not call these new functions `not-nil?`, `if-not-nil`, >>> and `when-not-nil`? Or, if "not-nil" is too unwieldy then what about >>> "exists" (`exists?`, `if-exists`, `when-exists`)? >>> >>> Are these names up for discussion? >>> >>> Cheers, >>> Dom >>> >>> >>> On Fri, Feb 14, 2014 at 11:04 AM, Alex Miller <al...@puredanger.com>wrote: >>> >>>> Clojure 1.6.0-beta1 is now available. >>>> >>>> Try it via >>>> - Download: http://central.maven.org/maven2/org/clojure/ >>>> clojure/1.6.0-beta1 >>>> - Leiningen: [org.clojure/clojure "1.6.0-beta1"] >>>> >>>> Highlights below or see the full change log here: >>>> https://github.com/clojure/clojure/blob/master/changes.md >>>> >>>> We expect Clojure 1.6.0-beta1 to be close to a release candidate; no >>>> other big changes are planned. Please give us your feedback and final >>>> issues if you find them so we can do the final release! >>>> >>>> Clojure 1.6.0-beta1 has the following changes from 1.5.1: >>>> >>>> 1) Clojure now builds with Java SE 1.6 and emits bytecode requiring Java >>>> SE 1.6 instead of Java SE 1.5. [CLJ-1268] >>>> >>>> 2) The following features are no longer marked "Alpha" in Clojure: >>>> >>>> * Watches - add-watch, remove-watch >>>> * Transients - transient, persistent!, conj!, assoc!, dissoc!, pop!, >>>> disj! >>>> * Exception data - ex-info, ex-data >>>> * Promises - promise, deliver >>>> * Records - defrecord >>>> * Types - deftype >>>> * Pretty-print tables - print-table >>>> >>>> 3) The clojure.java.api package provides a minimal interface to >>>> bootstrap >>>> Clojure access from other JVM languages. Example: >>>> >>>> IFn map = Clojure.var("clojure.core", "map"); >>>> IFn inc = Clojure.var("clojure.core", "inc"); >>>> map.invoke(inc, Clojure.read("[1 2 3]")); >>>> >>>> 4) Map destructuring extended to support namespaced keys. [CLJ-1318] >>>> >>>> In the past, map destructuring with :keys and :syms would not work >>>> with maps containing namespaced keys or symbols. The :keys and :syms >>>> forms have been updated to allow them to match namespaced keys and >>>> bind to a local variable based on the name. >>>> >>>> Examples: >>>> >>>> (let [m {:x/a 1, :y/b 2} >>>> {:keys [x/a y/b]} m] >>>> (+ a b)) >>>> >>>> (let [m {'x/a 1, 'y/b 2} >>>> {:syms [x/a y/b]} m] >>>> (+ a b)) >>>> >>>> Additionally, the :keys form can now take keywords instead of symbols. >>>> This provides support specifically for auto-resolved keywords: >>>> >>>> (let [m {::x 1} >>>> {:keys [::x]} m] >>>> x) >>>> >>>> 5) New "some" operations >>>> >>>> Many conditional functions rely on logical truth (where "falsey" >>>> values are nil or false). Sometimes it is useful to have functions >>>> that rely on "not nilness" instead. These functions have been added to >>>> support these cases [CLJ-1343]: >>>> >>>> * some? - same as (not (nil? x)) >>>> * if-some - like if-let, but checks (not (nil? test)) instead of test >>>> * when-some - like when-let, but checks (not (nil? test)) instead of >>>> test >>>> >>>> 6) Hashing overhaul >>>> >>>> The Clojure hash algorithms have changed for many primitives and >>>> collections. >>>> Read the changelog and http://clojure.org/data_structures#hash for >>>> more detail >>>> and if you are building external collections. >>>> >>>> In general, this change creates better hash codes (better bit >>>> dispersion, fewer >>>> collisions) to improve performance of hashed collections (maps and >>>> sets). >>>> *NOTE:* One side effect may be that code currently relying on the >>>> arbitrary order >>>> of hashed elements in a collection (tests for example) may need to be >>>> fixed. >>>> >>>> 7) Other new things >>>> >>>> * unsigned-bit-shift-right - Java's >>> >>>> * clojure.test/test-vars - run a set of tests with fixtures >>>> >>>> 8) Printing enhancements >>>> >>>> * [CLJ-908](http://dev.clojure.org/jira/browse/CLJ-908) >>>> Print metadata for functions when *print-meta* is true and remove >>>> errant space at beginning. >>>> * [CLJ-937](http://dev.clojure.org/jira/browse/CLJ-937) >>>> pprint cl-format now supports E, F, and G formats for ratios. >>>> >>>> 9) Error messages >>>> >>>> * [CLJ-1248](http://dev.clojure.org/jira/browse/CLJ-1248) >>>> Print type information in reflection messages to help diagnose >>>> problem. >>>> * [CLJ-1099](http://dev.clojure.org/jira/browse/CLJ-1099) >>>> If non-seq passed where seq is needed, error message now is an >>>> ExceptionInfo with the instance value, retrievable via ex-data. >>>> * [CLJ-1083](http://dev.clojure.org/jira/browse/CLJ-1083) >>>> Fix error message reporting for "munged" function names (like a->b). >>>> * [CLJ-1056](http://dev.clojure.org/jira/browse/CLJ-1056) >>>> Handle more cases and improve error message for errors in defprotocol >>>> definitions. >>>> * [CLJ-1102](http://dev.clojure.org/jira/browse/CLJ-1102) >>>> Better handling of exceptions with empty stack traces. >>>> * [CLJ-939](http://dev.clojure.org/jira/browse/CLJ-939) >>>> Exceptions thrown in the top level ns form are reported without file >>>> or line number. >>>> >>>> 10) Documentation strings >>>> >>>> * [CLJ-1164](http://dev.clojure.org/jira/browse/CLJ-1164) >>>> Fix typos in clojure.instant/validated and other internal instant >>>> functions. >>>> * [CLJ-1143](http://dev.clojure.org/jira/browse/CLJ-1143) >>>> Correct doc string for ns macro. >>>> * [CLJ-196](http://dev.clojure.org/jira/browse/CLJ-196) >>>> Clarify value of *file* is undefined in the REPL. >>>> * [CLJ-1228](http://dev.clojure.org/jira/browse/CLJ-1228) >>>> Fix a number of spelling errors in namespace and doc strings. >>>> * [CLJ-835](http://dev.clojure.org/jira/browse/CLJ-835) >>>> Update defmulti doc to clarify expectations for hierarchy argument. >>>> * [CLJ-1304](http://dev.clojure.org/jira/browse/CLJ-1304) >>>> Fix minor typos in documentation and comments >>>> * [CLJ-1302](http://dev.clojure.org/jira/browse/CLJ-1302) >>>> Mention that keys and vals order are consistent with seq order >>>> >>>> 11) Performance >>>> >>>> * [CLJ-858](http://dev.clojure.org/jira/browse/CLJ-858) >>>> Improve speed of STM by removing System.currentTimeMillis. >>>> * [CLJ-669](http://dev.clojure.org/jira/browse/CLJ-669) >>>> clojure.java.io/do-copy: use java.nio for Files >>>> * [commit](https://github.com/clojure/clojure/commit/ >>>> 0b73494c3c855e54b1da591eeb687f24f608f346) >>>> Reduce overhead of protocol callsites by removing unneeded generated >>>> cache fields. >>>> >>>> 12) Other enhancements >>>> >>>> * [CLJ-908](http://dev.clojure.org/jira/browse/CLJ-908) >>>> Make *default-data-reader-fn* set!-able in REPL, similar to >>>> *data-readers*. >>>> * [CLJ-783](http://dev.clojure.org/jira/browse/CLJ-783) >>>> Make clojure.inspector/inspect-tree work on sets. >>>> * [CLJ-896](http://dev.clojure.org/jira/browse/CLJ-896) >>>> Make browse-url aware of xdg-open. >>>> * [CLJ-1160](http://dev.clojure.org/jira/browse/CLJ-1160) >>>> Fix clojure.core.reducers/mapcat does not stop on reduced? values. >>>> * [CLJ-1121](http://dev.clojure.org/jira/browse/CLJ-1121) >>>> -> and ->> have been rewritten to work with a broader set of macros. >>>> * [CLJ-1105](http://dev.clojure.org/jira/browse/CLJ-1105) >>>> clojure.walk now supports records. >>>> * [CLJ-949](http://dev.clojure.org/jira/browse/CLJ-949) >>>> Removed all unnecessary cases of sneakyThrow. >>>> * [CLJ-1238](http://dev.clojure.org/jira/browse/CLJ-1238) >>>> Allow EdnReader to read foo// (matches LispReader behavior). >>>> * [CLJ-1264](http://dev.clojure.org/jira/browse/CLJ-1264) >>>> Remove uses of _ as a var in the Java code (causes warning in Java 8). >>>> * [CLJ-394](http://dev.clojure.org/jira/browse/CLJ-394) >>>> Add record? predicate. >>>> * [CLJ-1200](http://dev.clojure.org/jira/browse/CLJ-1200) >>>> ArraySeq dead code cleanup, ArraySeq_short support added. >>>> * [CLJ-1331](http://dev.clojure.org/jira/browse/CLJ-1331) >>>> Primitive vectors should implement hasheq and use new hash algorithm >>>> >>>> 13) Bug Fixes >>>> >>>> * [CLJ-1018](http://dev.clojure.org/jira/browse/CLJ-1018) >>>> Make range consistently return () with a step of 0. >>>> * [CLJ-863](http://dev.clojure.org/jira/browse/CLJ-863) >>>> Make interleave return () on 0 args and identity on 1 args. >>>> * [CLJ-1072](http://dev.clojure.org/jira/browse/CLJ-1072) >>>> Update internal usages of the old metadata reader syntax to new >>>> syntax. >>>> * [CLJ-1193](http://dev.clojure.org/jira/browse/CLJ-1193) >>>> Make bigint and biginteger functions work on double values outside >>>> long range. >>>> * [CLJ-1154](http://dev.clojure.org/jira/browse/CLJ-1154) >>>> Make Compile.java flush but not close stdout so errors can be >>>> reported. >>>> * [CLJ-1161](http://dev.clojure.org/jira/browse/CLJ-1161) >>>> Remove bad version.properties from sources jar. >>>> * [CLJ-1175](http://dev.clojure.org/jira/browse/CLJ-1175) >>>> Fix invalid behavior of Delay/deref if an exception is thrown - >>>> exception will >>>> now be rethrown on subsequent calls and not enter a corrupted state. >>>> * [CLJ-1171](http://dev.clojure.org/jira/browse/CLJ-1171) >>>> Fix several issues with instance? to make it consistent when used >>>> with apply. >>>> * [CLJ-1202](http://dev.clojure.org/jira/browse/CLJ-1202) >>>> Protocol fns with dashes may get incorrectly compiled into field >>>> accesses. >>>> * [CLJ-850](http://dev.clojure.org/jira/browse/CLJ-850) >>>> Add check to emit invokePrim with return type of double or long if >>>> type-hinted. >>>> * [CLJ-1177](http://dev.clojure.org/jira/browse/CLJ-1177) >>>> clojure.java.io URL to File coercion corrupts path containing UTF-8 >>>> characters. >>>> * [CLJ-1234](http://dev.clojure.org/jira/browse/CLJ-1234) >>>> Accept whitespace in Record and Type reader forms (similar to data >>>> literals). >>>> * [CLJ-1233](http://dev.clojure.org/jira/browse/CLJ-1233) >>>> Allow ** as a valid symbol name without triggering dynamic warnings. >>>> * [CLJ-1246](http://dev.clojure.org/jira/browse/CLJ-1246) >>>> Add support to clojure.reflect for classes with annotations. >>>> * [CLJ-1184](http://dev.clojure.org/jira/browse/CLJ-1184) >>>> Evaling #{do ...} or [do ...] is treated as do special form. >>>> * [CLJ-1090](http://dev.clojure.org/jira/browse/CLJ-1090) >>>> Indirect function calls through Var instances fail to clear locals. >>>> * [CLJ-1076](http://dev.clojure.org/jira/browse/CLJ-1076) >>>> pprint tests fail on Windows, expecting \n. >>>> * [CLJ-766](http://dev.clojure.org/jira/browse/CLJ-766) >>>> Make into-array work consistently with short-array and byte-array on >>>> bigger types. >>>> * [CLJ-1285](http://dev.clojure.org/jira/browse/CLJ-1285) >>>> Data structure invariants are violated after persistent operations >>>> when >>>> collision node created by transients. >>>> * [CLJ-1222](http://dev.clojure.org/jira/browse/CLJ-1222) >>>> Multiplication overflow issues around Long/MIN_VALUE >>>> * [CLJ-1118](http://dev.clojure.org/jira/browse/CLJ-1118) >>>> Inconsistent numeric comparison semantics between BigDecimals and >>>> other numerics >>>> * [CLJ-1125](http://dev.clojure.org/jira/browse/CLJ-1125) >>>> Clojure can leak memory in a servlet container when using dynamic >>>> bindings or STM transactions. >>>> * [CLJ-1082](http://dev.clojure.org/jira/browse/CLJ-1082) >>>> Subvecs of primitve vectors cannot be reduced >>>> * [CLJ-1301](http://dev.clojure.org/jira/browse/CLJ-1301) >>>> Case expressions use a mixture of hashCode and hasheq, potentially >>>> leading to missed case matches when these differ. >>>> * [CLJ-983](http://dev.clojure.org/jira/browse/CLJ-983) >>>> proxy-super does not restore original binding if call throws exception >>>> * [CLJ-1176](http://dev.clojure.org/jira/browse/CLJ-1176) >>>> clojure.repl/source errors when *read-eval* bound to :unknown >>>> * [CLJ-935](http://dev.clojure.org/jira/browse/CLJ-935) >>>> clojure.string/trim uses different definition of whitespace than >>>> triml and trimr >>>> * [CLJ-935](http://dev.clojure.org/jira/browse/CLJ-935) >>>> StackOverflowError on exception in reducef for PersistentHashMap >>>> fold >>>> * [CLJ-1328](http://dev.clojure.org/jira/browse/CLJ-1328) >>>> Fix some tests in the Clojure test suite to make their names unique >>>> and independent of hashing order >>>> * [CLJ-1328](http://dev.clojure.org/jira/browse/CLJ-1328) >>>> Empty primitive vectors throw NPE on .equals with non-vector >>>> sequential types >>>> >>>> Happy Valentine's Day! >>>> >>>> Alex Miller >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To post to this group, send email to clo...@googlegroups.com >>>> >>>> Note that posts from new members are moderated - please be patient with >>>> your first post. >>>> To unsubscribe from this group, send email to >>>> clojure+u...@googlegroups.com >>>> >>>> For more options, visit this group at >>>> http://groups.google.com/group/clojure?hl=en >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to clojure+u...@googlegroups.com. >>>> >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To post to this group, send email to clo...@googlegroups.com >>> >>> Note that posts from new members are moderated - please be patient with >>> your first post. >>> To unsubscribe from this group, send email to >>> clojure+u...@googlegroups.com >>> >>> For more options, visit this group at >>> http://groups.google.com/group/clojure?hl=en >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to clojure+u...@googlegroups.com. >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.