GithubHelp home page GithubHelp logo

Comments (3)

marcomorain avatar marcomorain commented on August 26, 2024 1

👋 hi @j0ni

from bond.

conormcd avatar conormcd commented on August 26, 2024

This only happens with with-stub! and not with with-stub, right?

In this case, my personal preference would be to change the behaviour of with-stub! from

Like with-stub, but throws an exception upon arity mismatch.

to

Like with-stub, but throws an exception upon arity mismatch where it's possible to detect such a mismatch. Some generated functions don't include :arglists in their metadata. For those functions, this macro will behave exactly like with-stub.

or something similar.

I wouldn't necessarily object to a warning, but this library does not currently depend on any logging interface or implementation and it would be nice to keep the dependencies as light as they currently are.

If others feel queasy about silently passing then we could insert something like:

(when-not (:arglists (meta v))
  (throw (new #?(:clj IllegalArgumentException :cljs js/Error)
         "with-stub! may only be used on functions which include :arglists in their metadata. Use with-stub instead.")))

in the appropriate position.

from bond.

j0ni avatar j0ni commented on August 26, 2024

Hey @conormcd, either of those solutions sounds ok to me, tho I would prefer the second.

I'm a fan of crashing over programming errors as early as possible, and this seems more like a programming error than a runtime snafu.

from bond.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.