News for hackers. Stuff that matters.
Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Monday February 05, 2018 @09:19AM (#16308844)
So this is literally Lisp, just with curly braces instead of parenthesis :).

I don't understand this part of the readme:

> The advantage of Mark over S-expressions is that it is more modern, and can directly run in browser and node.js environments.

Does this mean I'm so out of date with JS that this syntax is actually legit JS? Or does Mark run its own parsers, at which point it's just like sexps, except it uses the "more modern" curly brace instead of "less modern" parenthesis?

Re:Mark – A simple and unified notation for both object and ... by dustingetz on Monday February 05, 2018 @11:59AM (#16310099)
EDN, in addition to being simpler, also has an optimized transport abstraction, transit, which serializes to application/transit+msgpack (binary) or application/transit+json (often vastly faster deserialization than messagepack because which hits the language native JSON parsers for performance in web browser, python, etc). It surprised me how big a deal hitting native json parsers is, EDN was at the top of our profiler for 100kb payloads but transit+json is zippy. The abstraction also handles value de-duplication and has a human-readable verbose writer.

http://blog.cognitect.com/blog/2014/7/22/transit http://cognitect.github.io/transit-tour/

cool project though, good to see s-expressions become more popular

Re:Mark – A simple and unified notation for both object and ... by dragonwriter on Monday February 05, 2018 @09:30AM (#16308922)
> So this is literally Lisp

No, it's close to S-expressions, but it's not a programming language like Lisp.

> just with curly braces instead of parenthesis

Well, and more syntax than S-expressions: it's got both objects and arrays as fundamental structures instead of just lists, and it has commas as noise characters.

Re:Mark – A simple and unified notation for both object and ... by zeveb on Monday February 05, 2018 @11:23AM (#16309784)
> Well, and more syntax than S-expressions: it's got both objects and arrays as fundamental structures instead of just lists

Well, Common Lisp has both of those as fundamental atoms:

    #S(foo :bar 3)

    #(1 2 3)
The former creates an instance of a FOO struct with its BAR slot set to 3; the latter is a 3-item array.
Re:Mark – A simple and unified notation for both object and ... by nanny on Monday February 05, 2018 @04:07PM (#16312196)
And then CLOS objects, hash tables, regular expressions, etc. can be added with reader macros.
Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Monday February 05, 2018 @05:18PM (#16312770)
It's cool and I love it, but it's irrelevant in the context of a universal data exchange language. In such case, you'd want to have those primitives defined in the exchange language spec itself - even if you'd end up implementing them as reader macros in CL (which I don't recommend - reader macros turn your READs into EVALs, which you obviously shouldn't do on untrusted input).
Re:Mark – A simple and unified notation for both object and ... by zeveb on Monday February 05, 2018 @06:39PM (#16313285)
> you'd want to have those primitives defined in the exchange language spec itself

I agree with this: certain things need to be in the spec.

> even if you'd end up implementing them as reader macros in CL (which I don't recommend - reader macros turn your READs into EVALs, which you obviously shouldn't do on untrusted input).

This I don't agree with, because technically #\( & #\" are reader macros … they're just very well-defined reader macros. Presumably a spec which defined hash tables, regular expressions or whatever would define them as well as the Lisp spec defines lists and strings (and if not, well — it's a bad spec!).

Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Monday February 05, 2018 @06:57PM (#16313374)
> I agree with this: certain things need to be in the spec.

That was my main point. In the second part of the comment I didn't mean to discourage use of reader macros - it was more of an aside that the general facility of CL-style reader macros literally makes READ "shell out" into EVAL, so you need to (diligently) disable it for untrusted input (or reimplement a limited READ by hand). So we can't say "oh, but S-exps in Common Lisp can have anything through reader macros". Presumably if hash table literals were specified as a part of basic syntax, we could depend on it being standard and part of the safe subset of READ's duties; as it is however, we can't depend on it for arbitrary inputs.

Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Monday February 05, 2018 @09:41AM (#16308987)
Yeah, didn't mean it that literally.

> it's got both objects and arrays as fundamental structures instead of just lists

I'm bit sad that various lisps never standardized on a format for this; had they, then maybe we would have S-expressions as a popular data interchange format.

Re:Mark – A simple and unified notation for both object and ... by nabla9 on Monday February 05, 2018 @11:28AM (#16309823)
They did. It's called Common Lisp.
Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Monday February 05, 2018 @11:55AM (#16310058)
Common Lisp doesn't have a standard representation of hash tables, unfortunately. Also, CL didn't clean up the Lisp space completely; right now, there are Schemes, there's Clojure, LFE, Hy, and bunch of other niche Lisps, each with their own idiosyncrasies around syntax.
Re:Mark – A simple and unified notation for both object and ... by zeveb on Monday February 05, 2018 @06:23PM (#16313189)
> Common Lisp doesn't have a standard representation of hash tables, unfortunately.

Ah, but you mentioned objects & arrays, not hash tables grin. Agreed that hash tables would have been nice, although that does then get into issues such as canonical representations (which matter e.g. for hashing).

> Also, CL didn't clean up the Lisp space completely; right now, there are Schemes, there's Clojure, LFE, Hy, and bunch of other niche Lisps, each with their own idiosyncrasies around syntax.

It would be nice if folks who want to use Lisp would use Common Lisp rather than reïnventing various forms of more-or-less round wheel. It's a remarkably well-engineered language (not perfect, of course: argument order, upcasing, pathnames & environments all leap to mind as problematic areas), and so far as I can tell quite a bit better than any of the alternatives.

In particular, it'd be really nice to see people using Schemes for serious engineering work to use Lisp instead. It's just not well-suited to writing large systems, except by grafting on an ad-hoc, informally-specified, potentially bug-ridden subset of Lisp.

Re:Mark – A simple and unified notation for both object and ... by masklinn on Monday February 05, 2018 @09:38AM (#16308970)
> Well, and more syntax than S-expressions: it's got both objects and arrays as fundamental structures instead of just lists

Which can easily be added to sexps (see EDN).

Re:Mark – A simple and unified notation for both object and ... by kazinator on Monday February 05, 2018 @06:33PM (#16313245)
The S-expressions of mainstream Lisp dialects have objects and arrays. E.g. Common Lisp:

  ;; structure:
  #s(type :slot1 value1 :slot2 value2 ...)

  ;; vector:
  #(1 2 3 4)
Re:Mark – A simple and unified notation for both object and ... by anon1253 on Monday February 05, 2018 @10:15AM (#16309229)
Perhaps more like EDN since it doesn't have a runtime. But yeah, it's s-exps with curly braces. Which in my opinion, look worse than round parentheses … but that's opinion

https://github.com/edn-format/edn https://learnxinyminutes.com/docs/edn/

Re:Mark – A simple and unified notation for both object and ... by dunham on Monday February 05, 2018 @11:58AM (#16310093)
I really like edn. I wish it were more widely used.

It hits a sweet spot for me between yaml and json. Yaml is easy to type/read, but I feel it's a bit too complex on the parsing side. And json is a pain to type, so I'm reluctant to use it for human entered configuration files.

Re:Mark – A simple and unified notation for both object and ... by maxaf on Monday February 05, 2018 @09:30AM (#16308921)
"More modern" is a euphemism for "not made by someone who had a gray beard in 1975". It's just another form of ageism.
Re:Mark – A simple and unified notation for both object and ... by masklinn on Monday February 05, 2018 @09:37AM (#16308960)
Even by that criteria, there's EDN, which is basically sexp with more built-in types (and extensibility).
Re:Mark – A simple and unified notation for both object and ... by henryluo on Monday February 05, 2018 @06:42PM (#16313303)
Being 'more modern' means Mark takes a JS-first or web-first approach in its design. Whether we like it or not, JS has dominated the web. JSON is successful, partly because it takes a JS-first approach. Mark inherits this approach.
Re:Mark – A simple and unified notation for both object and ... by nfoz on Monday February 05, 2018 @05:26PM (#16312816)
The only ageist thing here is that you assumed the author's age, or that it had anything to do with the claim of modernity.
Re:Mark – A simple and unified notation for both object and ... by maxaf on Monday February 05, 2018 @05:53PM (#16312998)
Your statement is factually incorrect.
Re:Mark – A simple and unified notation for both object and ... by orf on Monday February 05, 2018 @09:35AM (#16308951)
It's sad that you feel that improving older, outdated technologies is a form of ageism.
Re:Mark – A simple and unified notation for both object and ... by maxaf on Monday February 05, 2018 @09:41AM (#16308988)
It is sad that so much junior talent is wasted on attempts at improvement via blind reiteration. This is one possible consequence of a mentorship vacuum: bright minds look for challenges, even ones that have been adequately overcome long ago. Imagine the good that would come of directing such energy with a clear purpose.
Re:Mark – A simple and unified notation for both object and ... by hobofan on Monday February 05, 2018 @11:01AM (#16309584)
There is nothing sad in that. Yes, it might be non-optimal, but by trying out your own approach you will find out its limitations first-hand and understand the problem and reasoning behind alternate approaches much better.

Junior talent doesn't become senior talent by just doing the right things, but by doing the wrong things and learning from them.

Re:Mark – A simple and unified notation for both object and ... by oorza on Monday February 05, 2018 @12:14PM (#16310238)
Junior talent becomes senior talent by virtue of acquiring experience. Doing the wrong things and learning is one way of acquiring experience, but being directed by a mentor is a much more efficient and productive way of acquiring that seniority. A lot of lessons learned from reinventing wheels can be distilled down into a conversation or a pair programming session, but in the absence of senior leadership, it becomes a week long hacking session on a library that will ultimately rot in Git forever because it's foundationally unsound.
Re:Mark – A simple and unified notation for both object and ... by tzahola on Monday February 05, 2018 @01:05PM (#16310615)
It becomes interesting when later said library is picked up and put into production by similar novices.
Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Monday February 05, 2018 @05:21PM (#16312791)
Yup. There really is nothing wrong with reinventing the wheel for educational purposes. The problem starts when that reinvented wheel gains a good README/webpage, and gets picked up by an ecosystem driven by novices.
Re:Mark – A simple and unified notation for both object and ... by tzahola on Monday February 05, 2018 @01:03PM (#16310600)
>Yes, it might be non-optimal, but by trying out your own approach you will find out its limitations first-hand and understand the problem and reasoning behind alternate approaches much better.

Hmm... I think that’s how PHP was made.

Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Monday February 05, 2018 @09:38AM (#16308967)
The problem here is that "modern" is usually a justification for regression, relative to older technologies, usually done by people who never bothered to look at the old technologies before declaring them obsolete.
Re:Mark – A simple and unified notation for both object and ... by Momquist on Monday February 05, 2018 @10:10AM (#16309195)
Reminds me of a recent talk at FOSDEM based on this premise.

The circuit less traveled. Investigating some alternate histories of computing: https://www.youtube.com/watch?v=jlERSVSDl7Y

Re:Mark – A simple and unified notation for both object and ... by TeMPOraL on Tuesday February 06, 2018 @12:53AM (#16314679)
Wow, that was a surprisingly insightful talk; thanks for linking!

I'm intrigued in particular by the talk's conclusion about (I guess, again) disappearing distinction between volatile and non-volatile storage. To date, I've been a vocal advocate of hierarchical filesystems (not UNIX, but just as a unit of user-facing abstraction). The talk sent me on the way of reflecting whether I'm not just supporting another historical "wrong path". Lots of more thinking in front of me here. So thanks.

Re:Mark – A simple and unified notation for both object and ... by masklinn on Monday February 05, 2018 @09:37AM (#16308964)
"Mark" does not improve on anything.
Re:Mark – A simple and unified notation for both object and ... by davidzweig on Monday February 05, 2018 @11:28AM (#16309825)
I would have rather said it's like QML language (which is used as the basis for Qt QML UI language). Can't find the link to the reference for plain QML. QML is like JSON, but with typed objects, and objects can have children in turn, so you can create tree structures from objects. It's actually very nice, I wish it had parsers for more languages.
Re:Mark – A simple and unified notation for both object and ... by odammit on Monday February 05, 2018 @10:40AM (#16309403)
It runs its own parser. Which means mark is a big silly ol string until you parse it.

var obj = Mark.parse(`{div {span 'Hello World!' }}`);

Re:Mark – A simple and unified notation for both object and ... by hepta on Monday February 05, 2018 @09:26AM (#16308900)
Doesn't seem like valid JS, you wouldn't need mark.js if that were the case.
Re:Mark – A simple and unified notation for both object and ... by afandian on Monday February 05, 2018 @10:31AM (#16309342)
Yes you would. JSON is valid JS, and executing JSON in a browser is a recipe for disaster.
Re:Mark – A simple and unified notation for both object and ... by minitech on Monday February 05, 2018 @01:08PM (#16310638)
JSON isn’t valid JS – its representation of strings allows U+2028 and U+2029 to appear unescaped, but JavaScript string literals don’t.

Not sure how else executing (valid) JSON in a browser would be a recipe for disaster? `eval` was the standard way to parse JSON from trusted sources for a long time.

Re:Mark – A simple and unified notation for both object and ... by Bahamut on Monday February 05, 2018 @09:40AM (#16308978)
> Does this mean I'm so out of date with JS that this syntax is actually legit JS? Or does Mark run its own parsers, at which point it's just like sexps, except it uses the "more modern" curly brace instead of "less modern" parenthesis?

It has its own parsing and stringify library it looks like: https://github.com/henry-luo/mark#markjs

Re:Mark – A simple and unified notation for both object and ... by henryluo on Monday February 05, 2018 @06:39PM (#16313286)
Firstly, I highly respect Lisp personally, and I have no intention of downplaying it. As some have seen, the Lisp spirit is actually in the design of Mark.

Secondly, to clarify what I mean by 'being more modern'. Of course, it does not mean changing from () to <> or {}, will make it more modern or something better.

Being 'more modern' means Mark takes a JS-first or web-first approach in its design. Whether we like it or not, JS has dominated the web. JSON is successful, partly because it takes a JS-first approach. Mark inherits this approach.

Being JS-first, means there'll be least adoption barrier in web.

Being JS-first, of course does not mean JS-only. Mark is designed to be generic and used by other programming languages like JSON.

Re:Mark – A simple and unified notation for both object and ... by k__ on Monday February 05, 2018 @09:30AM (#16308923)
I don't understand it either.

Looks like s-expressions to me and it isn't legit JS.

Re:Mark – A simple and unified notation for both object and ... by KirinDave on Monday February 05, 2018 @06:49PM (#16313332)
It's literally common lisp down to the use of pre-expressions with no binding as pragmas. It's like lisp someone dropped on a char and now all the parenthesis have a funny bump.

But it's not literally lisp in the sense that the meta-syntactic stuff isn't there.

Re:Mark – A simple and unified notation for both object and ... by raiflip on Monday February 05, 2018 @11:21AM (#16309757)
Genuine question, my impression is that Lisp is dynamically typed, but this uses type declarations. Would that make it different than Lisp?
Re:Mark – A simple and unified notation for both object and ... by kmill on Monday February 05, 2018 @02:31PM (#16311325)
Descriptions of typing are about as unevenly used as descriptions like "pass by reference." (So, practically useless.)

In Lisps:

- values have types (bool, symbol, number, list, array, structs, functions, ...)

- variables have by default one type: union of all the above

- in Common Lisp, you can restrict the types of values allowed in a variable

> but this uses type declarations

I must have missed this. If it's not just what struct-like entities are allowed in the markup, where did you see that?

Re:Mark – A simple and unified notation for both object and ... by bjoli on Monday February 05, 2018 @11:33AM (#16309864)
Lisp has strong typing, so 1 is 1, not "1" or #\1, which, unless mark has a built in way of annotating types doesn't give this any advantages over s-expressions.
Re:Mark – A simple and unified notation for both object and ... by kazinator on Monday February 05, 2018 @06:29PM (#16313224)
Lisp expressions also don't have any annoying type clutter that you have to have at every node in the syntax. Like (1 "1") is just a list of two things; we don't need the word "list" anywhere.
Re:Mark – A simple and unified notation for both object and ... by aylmao on Monday February 05, 2018 @10:59PM (#16314350)
It's a superset of JSON, which is valuable.