Comments (3)
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.
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.
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)
- Cannot-pipe-some-expressions can be solved with `$()` HOT 7
- Resolution: Class/Cannot-derive-from-dot-sourced/README.md HOT 3
- Potential collaboration with pwsh-live-doc HOT 3
- Is "*.ext matches *.ext*" related to 8.3 names? HOT 1
- A provider path passed *positionally* fails to make dynamic parameters available if it is placed *after* the dynamic parameter HOT 6
- [suggested trap] Weird null-ness HOT 10
- Powershell and lost exception origins HOT 2
- If-else blocks and array types HOT 13
- if statement is crazy HOT 6
- Async vs. Sync event handling HOT 5
- [suggested trap] should not use ValueFromPipeline with more than one param HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powershelltraps.