cnuernber / dtype-next

A Clojure library designed to aid in the implementation of high performance algorithms and systems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Annoying warnings with Clojure version => 1.11

chrysophylax opened this issue · comments

commented

As of clojure 1.11.0 there are built-in functions for abs, infinite? random--uid, parse-uuid in clojure.core. This means that we're doing an (seemingly) unnecessary replacement of builtins!

Can we bump clojure version compat to 1.11.x?

WARNING: abs already refers to: #'clojure.core/abs in namespace: tech.v3.datatype.functional-api, being replaced by: #'tech.v3.datatype.functional-api/abs
WARNING: infinite? already refers to: #'clojure.core/infinite? in namespace: tech.v3.datatype.functional-api, being replaced by: #'tech.v3.datatype.functional-api/infinite?
WARNING: abs already refers to: #'clojure.core/abs in namespace: tech.v3.datatype.functional, being replaced by: #'tech.v3.datatype.functional/abs
WARNING: infinite? already refers to: #'clojure.core/infinite? in namespace: tech.v3.datatype.functional, being replaced by: #'tech.v3.datatype.functional/infinite?
WARNING: abs already refers to: #'clojure.core/abs in namespace: taoensso.encore, being replaced by: #'taoensso.encore/abs
WARNING: random-uuid already refers to: #'clojure.core/random-uuid in namespace: tech.v3.io.uuid, being replaced by: #'tech.v3.io.uuid/random-uuid

I think it is important to understand first what the tech.v3.datatype.function namespace is in fact providing before we decide what is necessary or otherwise. From the namespace documentation:

Arithmetic and statistical operations based on the Buffer interface. These operators and functions all implement vectorized interfaces so passing in something convertible to a reader will return a reader. Arithmetic operations are done lazily. These functions generally incur a large dispatch cost so for example each call to '+' checks all the arguments to decide if it should dispatch to an iterable implementation or to a reader implementation. For tight loops or operations like map and filter, using the specific operators will result in far faster code than using the '+' function itself.

These operations are all vectorized in that they can take a single scalar or efficiently take reader/buffer/vector type data such as a dataset column. They then return a lazy noncaching but countable result that will calculate the result upon read.

So they aren't anywhere near the same as any of the builtin functions - which only take scalars and are generally fairly inefficient as they have to always check the type of the input and dispatch on that - something that I mention in all my talks and that is highlighted in the namespace documentation. This is why basic arithmetic operations such as +,-,etc are overridden.

As to your question - yes - we can bump the clojure version compat to 1.11 - but we have to solve this problem first and I believe the best way to solve it is with a macro that checks the current clojure version and does further exclusions if the version is 11 or greater.

commented

Aha! That makes a lot of sense. I rarely delve into this namespace but instead use the basic fns over in tech.ml and not having checked in detail assumed it was a pre-1.11-library fix --- my bad.

A macro seems appropriate.

Fixed in latest release