Fork me on GitHub
#off-topic
<
2020-04-22
>
borkdude09:04:57

I'm bike-shedding with myself over some keyword names in a library... :debug vs :debug? :throw vs :throw? The reason I'm leaning towards the first ones is: what if I want to extend the value to more than a boolean later? like {:throw {:exclude #{400}} Then the question mark suddenly doesn't make sense anymore.

reut.sharabani10:04:50

it still looks like a predicate. why does the ? stop making sense?

borkdude10:04:25

because ? implies that the value you pass to it is a boolean?

ashnur10:04:30

does it? πŸ™‚ I thought it implies that it returns a boolean

borkdude10:04:52

yeah, that's also not true, so there you have it: two reasons not to use the question mark?

pcbalodi10:04:17

I use the non ? version generally when there is extra information because I will find (:excludes throw?) harder to understand later

slipset10:04:43

A boolean is just an enum waiting to happen.

borkdude11:04:47

@pcbalodi good point

seancorfield17:04:29

For keywords, I'd definitely avoid ?. For (local) symbols that represent pure Boolean values, I'm on the fence. For function that return pure Boolean results, use ?. Years ago, clojure.java.jdbc had some keywords that ended in ? and several of them eventually came to allow non-Boolean truthy values. So when I wrote next.jdbc I decided that none of the keywords/options would end in ?` even if they only accept true/false today.

seancorfield17:04:18

Yeah, I think it took me seven or eight years to arrive at that position but it hasn't changed much in the last two to three years πŸ™‚

borkdude17:04:24

At work we have several question marks in API options, but it looks pretty weird if you call that API with JSON

seancorfield17:04:37

Yeah, we have legacy code that calls into Clojure from the JVM so even with predicates you end up calling stuff like $foo__QMARK__( x ); 😐

christian.gonzalez19:04:10

I want to set up an online ordering website for my dad’s bakery

christian.gonzalez19:04:25

anyone got success stories for setting up something quickly?

christian.gonzalez19:04:16

I was looking into using Hugo with some CMS tools

jlmr19:04:26

@christian.gonzalez I did something similar recently, using Hugo, forestry and snipcart. Worked great :+1:

include11:04:04

can we take a look at it? (url) πŸ™‚

jlmr20:04:23

Sure, don’t expect too much, it’s a simple site for my niece: https://github.com/jelmerderonde/ester

christian.gonzalez21:04:13

thanks for sharing