Skip to content

Looking for Feedback on: RFC0019-PowerShell-Core-Interop-Module #68

Closed

Description

@DarwinJS

Would love to hear everone's feedback on: RFC0019-PowerShell-Core-Interop-Module

Activity

  1. SteveL-MSFT commented on Feb 8, 2017

    @SteveL-MSFT
    Member

    In general, I think environmental variables (scoped to PowerShell) is a good way to abstract the OS and makes scripts portable. Perhaps this RFC should really be about identifying things that need to be abstracted and propose them as predefined variables/properties or cmdlets.

  2. DarwinJS commented on Feb 8, 2017

    @DarwinJS
    Author

    Steve Lee (@SteveL-MSFT) - I think that works well when reusing scripts built on Windows on Linux because windows is frankly better at abstracting common file locations via environment variables. If I look at environment variables on Linux there is very little of this - so the idea wouldn't be two-way. To take powershell written natively on Linux and make it run on Windows would seem to require symbolic file system links for directories like /tmp.

    I was proposing that it not be a built-in part of PowerShell because I know more than a few that would frown on a bunch of Windows-ee environment variables that are only available in the one shell that came from Windows.

    It also seems to me that if these were built-in there would be some pressure to not have too many cluttering up the system, where if it was an optional module loading - we could create as many mappings as desired as they would not be seen by anyone who did not need them.

    Also if it was a module, written in script, then those of us who only code in PowerShell could contribute and help maintain it more readily.

  3. SteveL-MSFT commented on Feb 8, 2017

    @SteveL-MSFT
    Member

    Darwin (@DarwinJS) regardless of whether it's in the PSCore package, I would agree that having it as a separate module makes sense. We can always add it to the package like PSReadline and Pester.

  4. DerpMcDerp commented on Feb 12, 2017

    @DerpMcDerp

    I was wishing there was a special ps: drive for PowerShell to store its variables instead of flooding the global variable namespace with new names every version.

    I think that would be the perfect place for this kind of interop stuff instead of having cmdlets or methods exposing these things.

  5. DarwinJS commented on Feb 12, 2017

    @DarwinJS
    Author

    Derp McDerp (@DerpMcDerp) - that sounds like an interesting way to handle things going forward.

    What I am driving at with this solution is compatibility with how millions of scripts have been written over the years and compatibility with how the code would "typically" be built today.

    Also, handling it in a compat layer means that the original code looks native on it's original platform for those not familiar with any new set of platform neutral references.

    That way the original script writer does not have to be conscious of building in platform neutrality ahead of time.

  6. iSazonov commented on Feb 27, 2017

    @iSazonov
    Contributor

    I would prefer first to have a detailed HowTo write portable Powershell script that could later be transformed into Core-Interop-Module.
    For portable modules Jason Shirk (@lzybkr) write Groundwork for portable modules PowerShell/PowerShell#3095

  7. Liturgist commented on Jun 27, 2017

    @Liturgist

    Darwin (@DarwinJS) - I am sure that I do not know of the deep, dark places you have been debugging. I am sure that you have seen many kinds of perverse situations and developed ways to overcome them. And, perhaps I do not really understand your proposal. There are a few things that raise my caution flag.

    The intent of "fixing up" PowerShell so that it is more friendly to various audiences is not always in the best interest of PowerShell. It creates diversity overhead. For example, when dir works one way on one platform and a different way on another. Providing a dir alias on Linux would seem to be more welcoming to the Windows user. The thing is that the dir alias command does not do exactly what the user is expecting. Yes, for dir alone it has a similar result, But, none of the switches from Windows will work. The ability to use dir alone on Linux is not that exciting or useful.

    The suggestion of $Env:IsWindows is scary to me. I do not know the magnitude of $define symbols created for the C language. Will we be getting $Env:IsLinux, $Env:IsMac. If PowerShell becomes a widely used language, will we need $Env:IsMVS, $Env:IsVMS, $Env:IsSolaris, $Env:Is???

    We should not be thinking of the world as having Windows programmers, Linux programmers, Mac programmers, and ??? programmers. An effective strategy would be to think of and press toward making PowerShell programmers.

    I fully agree with you that PowerShell should provide a $Env:TEMP variable on all platforms. The way to use this is $Env:TEMP. It is not /tmp or %TEMP%. Code written with a uniformly provided $Env:TEMP would not need any "fixing up." I would like to understand more about why you say that this should not be a built-in part of PowerShell. Not doing so would seem to be leaving the "fixup" complexity the responsibility of the developer.

    I prefer the Python approach of "let's pick one good way to do something and do that" over the Perl approach of "there's more than one way to do anything."

    If I do not understand the proposal, please say so. Thanks.

  8. DarwinJS commented on Jun 27, 2017

    @DarwinJS
    Author

    Liturgist - yes I think there is a bit of misunderstanding.

    In regard to "$Env:IsWHATEVER" - those are already part of PowerShell Core - I am only making a case to keep them consistent - not commenting on the merits of the implementation.

    In regard to the philosophy of whether we should think of the world as having platform oriented programmers - I'm a pragmatist. The software at my day job is 50/50 Linux and Windows and there are definitely real differences between the developers who have spent a good part of their career on one or the other - but most especially for those of us who focus on platform automation.

    I am one of few deep Windows automation developers at my company and in my experience intricate platform knowledge and debugging skills are quite frequently required to break through the barriers of getting something completely automated on either platform. I have 15 years on LAMP CLI and a decent bit of Bash as well as well as PowerShell on both platforms - so I am also personally aware of many of the differences.

    I would agree with you that for the high level programming languages that actually build the application itself - more agnosticism with regard to platform should be possible and should be promoted.

    There is also big, but frequently overlooked, difference between "proficiency" and "familiarity" - no one can maintain proficiency in an unlimited number of technologies - so I am cautious about DevOps thoughts that make it seem like a team can maintain strong, competent proficiency in a wide portfolio of technologies.

    There are also a lot of pragmatic technical details that interfere with the theortics of platform neutrality. For instance the file system slash - linux only takes it one way and windows takes it both - so use the Linux one everywhere right? Nope - direct calls to .NET classes (frequently in PowerShell) do not take the forward slash as a valid character - and the same with many platform utilities you might hand off to.

    I promoted the idea that things like $env:temp on non-windows not be part of the PowerShell engine itself for several reasons: [a] speed of implementation and future updates - they are not in the compiled code, [b] to avoid any wars about what variables belong in PowerShell and what ones do not - if they are all in an optional add-on, that is somewhat avoided, [c] the possibility of user extensibility and [d] I wanted it to be very clear that I was not advocating that these be added to Linux itself - but just the environment variables as seen in PowerShell.

    Some other cross references:

  9. SteveL-MSFT commented on Mar 18, 2019

    @SteveL-MSFT
    Member

    Darwin (@DarwinJS) The @PowerShell/powershell-committee believes that some of the original concerns have been addressed. Is this something you are still motivated to update and have more specifics on the gaps and what this module would solve?

  10. DarwinJS commented on Mar 18, 2019

    @DarwinJS
    Author

    Not sure how many read the original RFC - as it is not making a case to put any of this into the core.

    I'm definitely weary of waiting and advocating for the issue. I will keep writing my own library code that has to check what platform I'm on even though the underlying logical construct is on both platforms.

    As far as I'm concerned, we can close it due to lack of escape velocity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions