Code Monkey home page Code Monkey logo

Comments (3)

nightroman avatar nightroman commented on August 20, 2024

Yes, this should be in the list. I have been trapped by this feature, too. Not even because of typos. E.g. I expect a variable $x to be a scalar with some property Prop and I check this property as $x.Prop -eq 42. If something goes not as expected $x may be a collection instead of expected scalar. In this case in v2 $x.Prop -eq 42 gives either false or error in the strict mode. In v3 $x.Prop is a collection of values, one of them is 42, so my check gives true as if all is "fine". But I did not expect $x to be a collection. I.e. v2 helps me to reveal some unexpected issues earlier. v3 rather hides them at this point.

from powershelltraps.

nightroman avatar nightroman commented on August 20, 2024

For my use case at least there is a workaround. The check should be done as 42 -eq $x.Prop. Then it will not be evaluated to true if $x is a collection.

from powershelltraps.

nightroman avatar nightroman commented on August 20, 2024

Pushed as Collection-property-enumeration. Please close the issue if it looks good.

Later on I am going to add one more test case which shows how the typical "unexpected output" trap is combined with this one.

from powershelltraps.

Related Issues (12)

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.