Replies: 8 comments 6 replies
-
What does the binary format get you that you can't just get with a string with base64 in it? |
Beta Was this translation helpful? Give feedback.
-
A few things that seem trivial but have been gotchas for me in the past: Explicit typing (or type hinting, is maybe the better phrase): Having base64 between quotes and angle brackets definitely looks more or less the same to a parser, and mostly to a human. But if you think about a zero-length field, suddenly the differentiation makes a big difference —
The brackets would say to someone hand-modifying (or otherwise parsing) the kdl would immediately know that "OOTB": I'm sure many of the SDLang features removed are undoubtedly to reduce code size as well, but knowing that the language specifies (and therefore the parsers would be expected to implement) the conversion to and from base64 out of the box is one less thing that I've got to bring my own solution for. Sure going to-and-from base64 is pretty trivial, but being able to get/put binary data directly from the parser simplifies the end users' workflow, in my opinion. Definite portability: This one is incredibly minor compared to the other points I bring up for sure, but portability between applications using binary data would be far more guaranteed. Given a hypothetical situation of your application sending kml data to a server that you aren't controlling. If they were using a different variant of base64, you might find a situation where sometimes you'd produce output the server could handle, and maybe it couldn't. Some edge case like they leverage the MIME base64 functionality built into their server suite, but your application doesn't break lines at 76 characters. Self admittedly: most of these issues are something that could probably considered trivial, and I'm sure I'm not seeing the benefits and ease in parsing that comes with dropping binary literals, so perhaps that outweighs! |
Beta Was this translation helpful? Give feedback.
-
My opinion here is pretty weak, but I’m in favor of supporting binary literals using angle brackets. I kind of like the idea of being able to embed hex binary, for the sake of humans trying to read it, but base64 is probably better from a space perspective. There’s also Ascii85 which sounds interesting, and I think it would be neat to support e.g. The question really comes down to how much of a burden do we think it will be on parsers to have to deal with binary blobs? Also FWIW if we add this we’ll need to define
But that’s probably for the best anyhow. |
Beta Was this translation helpful? Give feedback.
-
The thing about specifying base64 allowing normalization across languages makes me think that, in practice, we would either put the community in a position where different languages interpret KDL differently based on particular quirks of their (existing) popular base64 implementations, or we would end up in a position where implementations HAVE to write their own base64 parsing because of (unintentional?) quirks in our own specification. I'd much rather leave this uncertainty in the hands of individuals, which is why I prefer letting people use strings for this. Note that this is not me saying that this conversation is over or anything. I'm mostly just expressing my own (current) thoughts on this. I wonder: What other document/configuration/etc formats have binary literals available? How do those work? SDLang is probably the first time I'd ever run into that in the wild. |
Beta Was this translation helpful? Give feedback.
-
While writing that last bit of jibberjabber, I did come up with another use case example for something that I've done in the past, where a binary literal would have been something I would have employed. I had a configuration file in JSON that would round-trip to the application. App might make changes to it, and would write it's config out on exit, but the user could modify the config while it wasn't running. I had a case I wanted to support where I would load in a small image (think website favicon style). The config had always allowed specification of a file path in the setting, but we came upon a situation where we had small chunks of binary PNGs that we wanted to use "one time". We decided on using a temporary directory and used paths to that, but it would have been a "neat" feature to be able to have the value for that key be optionally typed to a string or binary. The string would act as a file path as usual, but binary would be able to skip the extra file read and go right into the slot it was intended for. There's many ways to cook an egg, and I just think this is a novel one, I suppose! |
Beta Was this translation helpful? Give feedback.
-
I'm still not entirely into this feature, but there's #35 now so we can always add it later after we've had some more time to discuss it. Thanks for all your feedback! I know I'm not quite on board with this yet, but I'm definitely thinking about it and it might be harmless enough to add. |
Beta Was this translation helpful? Give feedback.
-
Looks like #35 is a great measure to be able to safely table the idea! Looking at your stated goals for kdl, this feature definitely would fall under "Flexibility", but certainly tug in the wrong direction for "Ease of implementation". I was giving it some more thought this afternoon too, and spent a little bit more time comparing it [kdl] to MySQL data types. Now obviously, as a database solution rather than serialization/config, MySQL cares a lot more about the intricacies of data types due to how they can (and can't) be leveraged in queries. My mental link in similarity to kdl (or sdl) between the In conclusion, I think I have to agree with you, especially if minimalist simplicity is a larger goal as kdl gets rolling. I think I personally like the idea of separate data types because of the mental organization and aesthetics of This has been a fun discussion, and I've enjoyed thinking about it! |
Beta Was this translation helpful? Give feedback.
-
Please see my response over here: #38 (comment). I think this is what I'm gonna end up going with for 1.0. |
Beta Was this translation helpful? Give feedback.
-
One of my favorite part about SDLang is their easy drop-in of base64 encoded binary data. Obviously that's not always super useful from a "configuration" usage point of view, but from a "serialization format" viewpoint, there will absolutely come a time when I'd want the ability to store binary data.
The majority of the things removed from SDLang make perfect sense, there are other ways to express the same things and/or reduce unneeded complexity. The same point could be made for binary data (could use multiple hex literals or the sort), or that could be "left as an exercise for the user" to implement the roundtripping of base64 encoded data.
I may be alone in this, but the built-in use of binary literals is something that I found as one of the attractive bits in SDLang to start with, and think it would benefit being included especially if kdl is intended to be used as a serialization format.
Keep up the great work!
Beta Was this translation helpful? Give feedback.
All reactions