You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 11, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 11, 2024. It is now read-only.
Make the potential loss of type fidelity clearer in the read-me #7
It is implied by your Get-UICulture example, for instance, but I suggest pointing out the constraints on type fidelity explicitly (which types can actually be fully round-tripped).
This is actually a very interesting point that I am also trying to get better implemented(/defined) from the script.
Taken the Get-UICulture example should actually not expand (as it can be round-tripped in the current environment), meaning:
[CultureInfo]'nl-NL'|ConvertTo-Expression#Should just return
[CultureInfo]'nl-NL'
Unless:
a property divers from the current system's default (e.g. $Object.Calendar.CalendarType -ne ([CultureInfo]'nl-NL').Calendar.CalendarType). This feature requires to investigate the object (and each recursive property) in -Depth prior possibly outputting it's own properties.
This should also apply to (e.g. string) decorations
The class doesn't exist --> transfer to [pscustomobject]
Certain switches and modes (I am also working on language modes) are set.
But it is getting pretty complex here and restarted this project several times. I think that I have a general view of what need to be done but I can't get my head around all the recursive functions and all conditions involved...
I have dropped the thought to automatically investigate the concerned properties whether they have any modifications in comparison the default, because:
It is too expensive
The result is still questionable as e.g. the default might differ on another system (e.g. due to the culture).
Anyhow, this whole question leads to a rabbit hole as there are a lot of exceptions for any direction you choose.
In a nutshell: it is almost impossible to set a solid common definition for the output fidelity.
Nevertheless, I completely recoded the ConvertTo-Expression cmdlet as part of a larger ObjectGraphTools set and copied your (this) question to there: iRon7/ObjectGraphTools#73. Where I tried to better document the fidelity.
Basically:
The PowerShell object parser behind the ConvertTo-Expression has a very high fidelity but the default fidelity of the ConvertTo-Expression cmdlet is bound to whether an object is able to roundtrip (based on the default output or a specific property.
(For details see the linked issue).
Btw the Get-UICulture output is a very good example of the HighFidelity switch (of the new ObjectGraphTools\ConvertTo-Expression cmdlet:
Get-UICulture|ConvertTo-Expression-HighFidelity
Which also is an example of all the exceptions as Get-UICulture returns a different base type in Windows PowerShell 5.1:
Thanks, @iRon7, good stuff (I assume you meant deprecate, and that you're referring to this stand-alone, Install-Script-based version of ConvertTo-Expression).
Thanks, @iRon7, good stuff (I assume you meant deprecate, and that you're referring to this stand-alone, Install-Script-based version of ConvertTo-Expression).
Activity
iRon7 commentedon Jul 20, 2022
This is actually a very interesting point that I am also trying to get better implemented(/defined) from the script.
Taken the
Get-UICultureexample should actually not expand (as it can be round-tripped in the current environment), meaning:Unless:
$Object.Calendar.CalendarType -ne ([CultureInfo]'nl-NL').Calendar.CalendarType). This feature requires to investigate the object (and each recursive property) in-Depthprior possibly outputting it's own properties.[pscustomobject]But it is getting pretty complex here and restarted this project several times. I think that I have a general view of what need to be done but I can't get my head around all the recursive functions and all conditions involved...
iRon7 commentedon Apr 11, 2024
I have dropped the thought to automatically investigate the concerned properties whether they have any modifications in comparison the default, because:
Anyhow, this whole question leads to a rabbit hole as there are a lot of exceptions for any direction you choose.
In a nutshell: it is almost impossible to set a solid common definition for the output fidelity.
Nevertheless, I completely recoded the
ConvertTo-Expressioncmdlet as part of a largerObjectGraphToolsset and copied your (this) question to there: iRon7/ObjectGraphTools#73. Where I tried to better document the fidelity.Basically:
The PowerShell object parser behind the
ConvertTo-Expressionhas a very high fidelity but the default fidelity of theConvertTo-Expressioncmdlet is bound to whether an object is able to roundtrip (based on the default output or a specific property.(For details see the linked issue).
Btw the
Get-UICultureoutput is a very good example of the HighFidelity switch (of the newObjectGraphTools\ConvertTo-Expressioncmdlet:Which also is an example of all the exceptions as
Get-UICulturereturns a different base type in Windows PowerShell 5.1:(Get-UICulture).PSTypeNames Microsoft.PowerShell.VistaCultureInfo System.Globalization.CultureInfo System.ObjectiRon7 commentedon Apr 11, 2024
I will soon deplete this
ConvertTo-Expressioncmdletmklement0 commentedon Apr 11, 2024
Thanks, @iRon7, good stuff (I assume you meant deprecate, and that you're referring to this stand-alone,
Install-Script-based version ofConvertTo-Expression).iRon7 commentedon Apr 11, 2024
Correct
(Yes, I meant deprecate.)