What application a file works with isn't exactly metadata ... that's
what we use extensions for on Windows, after all ;) But of course, most
apps do what PowerShell has decided (belatedly) to do: open old files in
the new version fine (or convert them), and cause the old apps to throw
errors when you open a file for the new version.
IMO, the problem with that in a shell is that you can't use it to alter
the command-line completion.
So, if you have a "script.ps1" file in a folder which is in your
$ENV:PATH ... PowerShell 1 will execute it when you type "script" in the
console. But it wouldn't do that if the file was named script.ps2 ...
and of course, a PowerShell 2 could look for ps2 AND ps1, but prefer ps2
the same as it prefers .ps1 to .exe.
So, if you use metadata instead of file extensions as a way to control
compatability, then two things happen (which are bad, in my opinion):
1) You have no way to have a v1 and a v2 version of a command which you
can put in a folder on your USB thumbdrive and add to the PATH whever
you go ... except to have something like "script.ps1" that calls either
"script-v1.ps1" or "script-v2.ps1" depending on the situation -- so if
you have any reason to have to ocassionally work on v1, you're going to
be tempted to keep all your scripts at v1.
2) Version 1 has to (attempt to) parse/execute v2 scripts to discover
they won't work, and thus show errors, instead of just ignoring them.
*shrug*
None of it is a big deal, one way or the other ... but for the scenarios
that I can think of, the extension seems better.
--
Joel
Post by Josh EinsteinMy argument against .ps10 has nothing to do with 8.3... it has to do
with using file extensions as metadata. That's what #requires is for and
with .psd1 its given us a nice clean way of declaring prerequisites.
Anyway, yeah having a file extension get versioned is crazy. But having
one that is supposed to have been versioned but decided against, that's
even crazier.
Josh
Post by Joel BennettWell, what's wrong with having .PS10? Hopefully by now we've all moved
past the whole 8.3 mindset, and aren't using any tools that have
issues with 4 character file extensions?
If they're not going to increment the numbers with every version, I'd
rather have .psh or .posh, over .ps1 -- but in principle I have no
problems with using .ps1 and .ps2 and .ps3 as long as they are consistent.
Personally I'd just as soon have them changed whenever the scripts in
a new version aren't guaranteed backwards compatible. Older,
forward-compatible versions' extensions could still be executable, and
the broken backwards compatability would be clear and obvious without
trying to run the script, or reading the source.
--
Joel "Jaykul" Bennett