Giter Site home page Giter Site logo

check single integer about checkmate HOT 5 CLOSED

mllg avatar mllg commented on August 17, 2024
check single integer

from checkmate.

Comments (5)

berndbischl avatar berndbischl commented on August 17, 2024

RTFM you bloody noob !!!!

Hi Dirk, more seriuosly there is this overview, that mentions scalars
https://github.com/mllg/checkmate

There is checkInt and checkCount?

from checkmate.

surmann avatar surmann commented on August 17, 2024

Take it from me, I did!

I looked at checkInt, checkCount and all the others that check numeric values. However, in my opinion they seem to be for real or integerish values, not for native integer values because of the tol value. checkInt(4) is TRUE but not checkInteger(4).

Probably I interpret or use some functions in a wrong manner?

from checkmate.

berndbischl avatar berndbischl commented on August 17, 2024

So, you want to function that lets 1L pass, but not 1?

from checkmate.

berndbischl avatar berndbischl commented on August 17, 2024

What I should add here:
Nearly always I want this behavior: I have a function f(k) where k is supposed to be an int.
Now, a user should be able to say f(1L) and f(1), as
a) most users do not even really know that 1 is NOT an int. I dont want to hassle them with an error.
b) typing the L might be cumbersome

So what i do is
k = asInt(k)

  • That performs a check whether k is "integerish", so allow 1 as well
  • after the above line I have type-safety, so I know that k is now really of type "integer" in my code, as it is potentially converted from 1 to 1L

Does that make sense?

from checkmate.

surmann avatar surmann commented on August 17, 2024

First Comment: Yes.
Second Comment: That makes sense, I will use it this way.

Thanks!

from checkmate.

Related Issues (20)

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.