-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some constructions, modifying the behavior, should be annotated in order to enrich the information of the AST #83
Comments
Filter function Get-Square2 { $_ * $_ }; Filter Get-Square2 { $_ * $_ } A function with a particular behavior. |
@LaurentDardenne would you have a proposal for what explanations for these should look like? Please note that |
>>would you have a proposal for what explanations for these should look like? [void]$T.Add(1) ; $T.Add(2) > $null The objective is identical but the syntax is different, here it is more an intention that needs to be explained, it is a recognition of instruction patterns. |
A good suggestion I think. |
>>For the ... > $null situation, which is similar to $null = ... and ... | Out-Null, the intent is the same, For Out-null the documentation is explicit and logically an Out-xxx cmdlet should be the last statement in a pipeline. |
[Void]
Here [void] is not only a cast but modifies the emission of a data in the pipeline and avoids a side effect, so it is a behavior to be aware of.
See
"This type cannot be instantiated. It provides a means to discard a value explicitly using the cast operator"
Comma operator with Return
For the 'Return' instruction, the comma operator avoids enumerating the collection (cf. Write-Output -NoEnumerate), in this case we want to retrieve the type of the collection and its content and not just the content of the collection, it is therefore a behavior to be aware of.
There is also this specific case (rare) :
Because of the method signature :
Variable name with space
Switch parameter and a value
The text was updated successfully, but these errors were encountered: