clojure-dev

mfikes 2022-12-11T21:06:39.251899Z

Wondering if this behavior change is considered a bug, undesired, or irrelevant:

Clojure 1.11.1
user=> (drop 1.5 [1 2 3])
(3)
user=> (drop 1.5 (seq "abc"))
(\c)
vs.
Clojure 1.12.0-alpha1
user=> (drop 1.5 [1 2 3])
(2 3)
user=> (drop 1.5 (seq "abc"))
(\b \c)

borkdude 2022-12-11T21:13:28.515059Z

@mfikes There is a precedent in https://github.com/borkdude/speculative/commit/2460379417c0ac6d49327fef54a40a597ed0dcfd where we relaxed int to number for range

borkdude 2022-12-11T21:16:31.275059Z

Can't find any discussion other than this: https://clojurians.slack.com/archives/CDJGJ3QVA/p1540381365000100

Alex Miller (Clojure team) 2022-12-11T21:18:51.198439Z

That seems to be a different discussion. Range supports all number types.

borkdude 2022-12-11T21:19:11.803879Z

What's the use case for non-int in range again?

Alex Miller (Clojure team) 2022-12-11T21:20:02.477409Z

Ranges of non ints?

borkdude 2022-12-11T21:20:33.725029Z

oh duh, yes, that's kind of obvious

Alex Miller (Clojure team) 2022-12-11T21:20:41.074969Z

Range makes a series of numbers from start number to end number, stepping by numbers

Alex Miller (Clojure team) 2022-12-11T21:16:42.280669Z

I would consider non integers to be undefined behavior

mfikes 2022-12-11T21:18:14.405139Z

It would also seem that if you tried to define the behavior you might go down an intractable rat hole.

mfikes 2022-12-11T21:20:30.606969Z

I was messing with porting this (`IDrop`) to ClojureScript and that WIP implementation definitely exhibits undefined behavior.

cljs.user=> (drop 1.5 (seq "abc"))
(nil nil)
There have been cases in the past where these sorts of things have been pushed to have ClojureScript match Clojure, where reasonable, perf-wise.

mfikes 2022-12-11T21:22:29.420589Z

Cool. I won't report a bug against 1.12.0-alpha1.