noprompt / meander

Tools for transparent data transformation
MIT License
918 stars 55 forks source link

Allow type checks and bound checks to be disabled #178

Closed noprompt closed 3 years ago

noprompt commented 3 years ago

This patch allows the programmer to disable type checking and bounds checking through meta data on a match, find, search, etc. form.

Disable both type and bounds checking

^::m/unsafe (m/match ,,,)

Disable only type checking

^::m/no-type-check (m/match ,,,)

Disable only bounds checking

^::m/no-bounds-check (m/match ,,,)
noprompt commented 3 years ago

@jimmyhmiller If you have the availability, could you verify tests pass on your machine? I've run each of the commands given by our workflows and all pass on my machine. I don't understand why the cljs build is failing.

lucywang000 commented 3 years ago

👏 👏

lucywang000 commented 3 years ago

What about adding a flag that turns off these checks globally? That would be more handy than adding these metadata everywhere.

noprompt commented 3 years ago

@lucywang000 applying the flags globally would cause some existing code to break. An alternative to global flags would be new macros ie. match! etc. which expand to forms with the unsafe meta attached. What do you think?

lucywang000 commented 3 years ago

@noprompt Not sure that's a good idea either ... introducing a new set of macros (i.e. match! for match, search! for search) could be a bit confusing for newcomers too.

noprompt commented 3 years ago

@lucywang000 I agree. Its the smallest non breaking change I can think of. A compromise between local (at the macro) and global configuration would be to have configuration at the namespace level and expose a function/macro for setting it.

(m/set-environment! {,,,})
noprompt commented 3 years ago

I'm moving this discussion here.