One of the biggest missing features surely? "Everything is a string" is a terrible design.
One of the biggest missing features surely? "Everything is a string" is a terrible design.
The world tried "everything is XML" and more recently "everything is JSON" as a solution to this. The latter is almost there.
Where in self-describing data formats like JSON or XML (or even the more efficient encodings like ASN.1), every term is "described in place", taking up a lot of encoding overhead and bandwidth; in a self-describing stream container format, each encoded stream first encodes a schema (or the ID of one) for what it's about to transmit; and then transmits the terms encoded using the schema.
Because schemas are referred to by embedding them in the document in a normalized form, each stream received by a client can be handled by a hybrid approach between building up just-in-time dynamic parsers from the schema, if it's not known; or recognizing known schemas (by e.g. hashing the representation of the schema, which works since it's in a normal form) and using a baked-in decoder for that specific schema if available.
This would work pretty well as an enhancement to standard POSIX CLI IO-streaming tools; they'd be able to use specific logic to optimize the parsing of a few schema-encoded types they "expect", while also faithfully (but less efficiently) handling data of any type by falling back to a generic parser routine. (By which I don't mean "falling back to treating the stream as text", but rather "falling back to treating the stream as the custom type that the sender specified." Sort of like how, in most languages, you can compile regexes that are available at compile time, but also have a regex interpreter for regexes received at runtime.)
Not sure what you mean by this. This code works fine:
$credential = Get-Credential -Message "Enter Credential"
$credential | Export-Clixml "credential.xml"
$credential = Import-Clixml "credential.xml"
You can also $variable | Out-File ./file.txt
if you just want to save the text output.Take a look at all the quoting options of `ls` for an example of the insanity caused by streams being untyped.
It is still outdated design, right from the 60s. Already in the 70s we had better, interchangeable data structures, like s-expressions for example.
[1] - Apart from arrays, which are probably the biggest wart in the language. Fortunately, Tcl 8.5 introduced dicts which fulfil the same role as arrays, but as opposed to them, they are strings.