Why not Jester[1]? Jester has a better API, IMO. [1]: https://github.com/dom96/jester
I wrote Rosencrantz because I do not like the Jester API very much. Jester, like many other frameworks, hardcodes exactly what to do with a Request - say parsing the headers, parsing the form if the content type suggests so, always return a date, and so on. This is not bad per se, but I prefer to have something I can compose. Say, I have a working route `r`. If I want to add CORS support, for instance, I can just mak…
Rosencrantz – A Web DSL for Nim
11–20 of 31 posts
Re: Rosencrantz – A Web DSL for Nim
#12Nim is one of those underpublicized language. It's really good, I will leave it at that. I've used it a few times and it takes maybe 10 minutes to get back into it. It's perfect for making tools.
Yeah, I also had positive experience with nim. I'm not sure why it's so unknown, maybe because it fits in the same niche between rust and go and not backed up by any major company in industry. But I highly recommend trying Nim out!
That is pretty much the entire reason. Any technology not being backed by a large player in the industry has a much tougher time getting traction.
Re: Rosencrantz – A Web DSL for Nim
#13Nim is one of those underpublicized language. It's really good, I will leave it at that. I've used it a few times and it takes maybe 10 minutes to get back into it. It's perfect for making tools.
Yeah, I also had positive experience with nim. I'm not sure why it's so unknown, maybe because it fits in the same niche between rust and go and not backed up by any major company in industry. But I highly recommend trying Nim out!
Re: Rosencrantz – A Web DSL for Nim
#14Nim is one of those underpublicized language. It's really good, I will leave it at that. I've used it a few times and it takes maybe 10 minutes to get back into it. It's perfect for making tools.
Yeah, I also had positive experience with nim. I'm not sure why it's so unknown, maybe because it fits in the same niche between rust and go and not backed up by any major company in industry. But I highly recommend trying Nim out!
Re: Rosencrantz – A Web DSL for Nim
#15Nim is one of those underpublicized language. It's really good, I will leave it at that. I've used it a few times and it takes maybe 10 minutes to get back into it. It's perfect for making tools.
What does "tools" mean here and what is it about the language that makes it suitable for writing such things?
Edit: I fear I might have sounded snarky here, but it's just my "I want to learn" voice.
Re: Rosencrantz – A Web DSL for Nim
#16Earlier quoted context omitted.
Yeah, I also had positive experience with nim. I'm not sure why it's so unknown, maybe because it fits in the same niche between rust and go and not backed up by any major company in industry. But I highly recommend trying Nim out!
Are Rust and Go in the same niche?
Re: Rosencrantz – A Web DSL for Nim
#17Nim is one of those underpublicized language. It's really good, I will leave it at that. I've used it a few times and it takes maybe 10 minutes to get back into it. It's perfect for making tools.
Yeah, I also had positive experience with nim. I'm not sure why it's so unknown, maybe because it fits in the same niche between rust and go and not backed up by any major company in industry. But I highly recommend trying Nim out!
Most programmers I know don't even know what a pragma is; Nim uses them extensively. Nim has types, objects, is low level, can be compiled to shared objects (something that didn't come out to Go until 1.5), macros, generics, templates, oh and it compiles to both C and JavaScript (and C++, and Objective C in case you need easy bindings for those), dynamic dispatch, mutually recursive types, pointers, named arguments, tricky hash tables, procedures that look like functions or methods (whichever suits you), and an irrelevant casing (spellLikeThis is the same is spell_like_this - case only matters for the first letter and underscores don't matter), and many more.
All of this on top of a hyper fast (~2x the speed of Go) compiled language.
Most other very complete languages are not compiled so you can kinda muck around in a repl and use introspection to figure out whats going on. Nim isn't like that. You need to think and figure things out when you're first learning it. Furthermore Nim isn't yet at 1.0 and lacks its killer library. Go and Rust are easier to get started with because they are simpler languages. They are easier to teach and easier to write documentation for.
Nim kinda reminds me of Ember or Rails or C++(see note): Huge, but worthwhile to learn because you'll never feel constrained by it. I highly doubt it will ever be as mainstream as Go though. I've generally found that most people are too lazy to learn harder languages / libraries.
Note: I do not like C++ for many reasons. The tooling is crufty, syntax is awful, impossible to reason about a codebase unless its picked a subset of C++; but the one thing I'll grant C++ is that you can always eventually get what you want done.
Re: Rosencrantz – A Web DSL for Nim
#18Sad to see all these [] and () in Nim, which has such a beautiful syntax to start with.
What would you suggest instead? Routes are naturally nested, and overloading [] seemed the best choice
I've written a number of Nim libs at this point. Rosencrantz is missing the idiomatic 'feel' of Nim -- blocks and trees. I would rather see a syntax like this:
let handler = firstOf:
get:
firstOf:
path("/api/status"):
ok(getStatus())
pathChunk("/api/message"):
accept("application/json"):
intSegment(id):
let message = getMessageById(id)
ok(message)
post:
path("/api/new-message"):
jsonBody(msg):
let
id = generateId()
saved = saveMessage(id, msg)
if saved: ok(id)
else: complete(Http500, "save failed")
I believe all of that should be possible using templates; grab the AST for the `stmt` passed to each function, then iterate over each node.Re: Rosencrantz – A Web DSL for Nim
#19Earlier quoted context omitted.
What would you suggest instead? Routes are naturally nested, and overloading [] seemed the best choice
I came here to say the same thing as the GP. So while I am not the poster you responded to, I'll pitch in my opinion. I've written a number of Nim libs at this point. Rosencrantz is missing the idiomatic 'feel' of Nim -- blocks and trees. I would rather see a syntax like this: let handler = firstOf: get: firstOf: path("/api/status"): ok(getStatus()) pathChunk("/api/message"): accept("application/json"): intSegment(id…
Templates would allow for the syntax you present, but do not combine.
Re: Rosencrantz – A Web DSL for Nim
#20Earlier quoted context omitted.
I came here to say the same thing as the GP. So while I am not the poster you responded to, I'll pitch in my opinion. I've written a number of Nim libs at this point. Rosencrantz is missing the idiomatic 'feel' of Nim -- blocks and trees. I would rather see a syntax like this: let handler = firstOf: get: firstOf: path("/api/status"): ok(getStatus()) pathChunk("/api/message"): accept("application/json"): intSegment(id…
The problem with this approach is that it would be difficult to make handlers first-class. What if your post routes are a handler imported from another module? Templates would allow for the syntax you present, but do not combine.
For example, the 'firstOf' template above would be responsible for scanning the AST it's given, taking each node and putting it in to a sequence. Then it instantiates a Handler with that sequence and returns it.