Giter Club home page Giter Club logo

Comments (3)

dlwyatt avatar dlwyatt commented on May 16, 2024

If you need to support PowerShell v2, then you must specify the =$true part. For code that requires v3 or later, I prefer to omit that, but I don't think it matters all that much for a style guide.

from powershellpracticeandstyle.

KirkMunro avatar KirkMunro commented on May 16, 2024

Language enhancements like these that are non-functional improvements. With non-functional language improvements, I always err towards sticking with the old syntax until the non-functional improvement is in the lowest version that I or others who use my modules are likely to run into. For now there is still a lot of PowerShell 2.0 out there so I write my modules using syntax that is understood by 2.0, even if the modules themselves are declared as having a minimum PowerShell version requirement higher than that. This allows someone working on PowerShell 2.0 to still use my code as an example without scratching their head about syntax errors due to non-functional improvements, while still being completely functional in all other versions that are available. Once the minimum standard moves up to 3.0, I'll probably adopt the 3.0 non-functional language improvements in my modules. That's just my approach though.

from powershellpracticeandstyle.

ryanspletzer avatar ryanspletzer commented on May 16, 2024

Perfect, exactly the guidance I was looking for, thanks!

from powershellpracticeandstyle.

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.