ServerJS/Binary/C: Difference between revisions

m
grammar, spelling, active voice, some clarifications in the introduction
No edit summary
m (grammar, spelling, active voice, some clarifications in the introduction)
Line 1: Line 1:
This proposal was written by Daniel Friesen as an alternative to the Binary/B proposal.
This proposal was written by Daniel Friesen as an alternative to the [[ServerJS/Binary/B|Binary/B]] proposal.


It reflects the Blob type that is used in a number of existing Server-side JavaScript
This proposal extends the Blob type that a number of existing Server-side JavaScript implementations use, and a Buffer type reflecting the StringBuffer/StringBuilder within Java.
implementations, as well as a Buffer type reflecting the existing StringBuffer/StringBuilder within Java.


ByteArray is excluded and Buffer proposed instead. A short note, none of the prior
This proposal has a Buffer instead of Binary/B's ByteArray. None of the prior art actually implemented a ByteArray as Binary/B proposes. Most implementations implemented a Blob type similar to Binary/B's ByteString, and any that implemented something called ByteArray actually implemented something more like a stream API based buffer rather than
art actually implemented a ByteArray as Binary/B proposes. Most implementations
anything remotely resembling an Array.
implemented a Blob type, and any that implemented something called "ByteArray"
actually implemented something more like a stream API based buffer rather than
anything remotely resembling an array.


One of the important points thought about in this proposal was interoperability between strings and blobs.
One goal of this proposal is interoperability between Strings and Blobs. That is, like Binary/B, this proposal aims to permit a class of generic algorithms that can operate on both Blob and String through a generic intersection between their API's. However, unlike Binary/B, this proposal avoids things that seem counter-intuitive, like putting .charAt on a Blob, a byte collection.  Instead, this proposal augments String with a .valueAt so that method can be used generically on both Blob and String.
ie: The ability to write code that can abstractly extract, combine, buffer, and whatnot strings and blobs with a api ignorant of whether the data is binary or text. As well things which seamed counter-intuitive (putting .charAt on Blob) were avoided.


Most of this was based off of APIs drafted for MonkeyScript ([http://draft.monkeyscript.org/api/_std/Blob.html Blob] [http://draft.monkeyscript.org/api/_std/Buffer.html Buffer]).
This proposal is based off of API's drafted for MonkeyScript ([http://draft.monkeyscript.org/api/_std/Blob.html Blob] [http://draft.monkeyscript.org/api/_std/Buffer.html Buffer]).


== Terms ==
== Terms ==
171

edits