I don't even know why I try to understand things sometimes. Toying with adding
pipelining support, I added some echo("OUT ", headersString) and echo("IN",
line) to httpclient.nim to see what was actually being sent when. Then I ran
this script:
import asyncdispatch, asyncfutures,
Hi. I'm not really super smart about this stuff, but there are a few things I'm
confused on, that I think I might be able to understand. So from the blog:
> Type-specific allocation turns every "use after free" bug into a logical bug
> but no memory corruption can happen.
But memory corruption
Thanks for implementing it! The only problem I ever had was how you can't bind
var parameters, since it assumes you might be resuming the future in a
different thread. object = await object.method(...) works for most of the time
I'd want to pass a var object though.
I mean a string composed of tokens. You can't do say parseExpr{a * x + b} which
in D just syntax highlights everything normal even inside the {}. parseExpr"a *
x + b" requires the editor to treat everything between "a * x + b" as untyped,
untokenized string characters.
It's really a very minor
* _D_ \- concurrency uses kernel threads or longjmp, with little language
support for async semantics
* _Nim_ \- has await. Rewrites procedures to be async friendly. Futures that
don't rely on kernel threads.
That's basically the biggest factor in my mind for using Nim. Everything I can
I think `lineInfo` is what I'm looking for, and it looks like it exists!
Combined with getType, since otherwise it's just the file that the findsym
statement is in.
from macros import lineInfo,getType
macro findsym(x: typed): untyped =
debugEcho(lineInfo(x.getType))
I was going through filling up another two pages with exhaustive lists of `from
foo import `[]`, const1, const2, const3, const4, const5, ...` and it occurred
to me, if I import `"`[]`"` from a bunch of different modules, even if I use
the `from X import Y` syntax, I still can't tell which
Just for fun, I went and parallelized creation of each branch of the tree.
There's a race condition between "preferSpawn" and "spawn" so it occasionally
locks up, since you can't stop another thread from spawning new workers between
preferSpawn and spawn. You can't wrap that code in a lock
making a Tree() puts it on the stack, and makes it scoped, which is neat, but
probably not what you're looking for. What you're doing is like this in C:
struct Tree {
struct Tree* left;
struct Tree* right;
};
struct Tree make_tree(int n) {
struct Tree
That's good information, I suppose. Still doesn't let me chain iterators in a
"for" statement, leaving people having to examine my code to figure out what I
mean by "chain(a,b)" It also relies on magic identifiers like "str" and "v". I
ended up messing around with macros to get the desired
So, if I understand it right, when you have to update an object of a certain
type, you generally have to do the same thing to all objects of that type.
Thus, having the object store a pointer to its update function isn't very
helpful, since you can just keep a table of all such objects that
import times
var ifo = getGMTime(getTime())
echo(ifo)
Warning: Cannot prove that 'ifo' is initialized. This will become a compile
time error in the future. [ProveInit]
I've looked over the code in times.nim, but getGMTime just returns
tmToTimeInfo(), which
Not really, because you still can't define procedures that way. It is neat that
you can define unnamed blocks though, instead of a dummy name procedure. I
think what I'm looking for is the {.global.} keyword, actually:
proc something(): foo =
var thing {.global.} =
Often I'll have surrounding context that I use to define something, that has
very little relevance outside of that something. For instance:
let placeholder = "first $delim second $delim third".split("$delim",2)
let first = placeholder[0]
let second = placeholder[1]
let
I'd like to have something like
type Level = enum
LOW HIGH
template low*(arg: expr): stmt =
something(Level.LOW,arg)
template high*(arg: expr): stmt =
something(Level.HIGH,arg)
But I don't want to copy and paste the same template declaration code for every
kind of "Level". Is it
Yeah, seeing Nim compile itself is pretty incredible, compared to the 3 hours
it takes to compile rust. D:
But C++ is very, very ...very bad at compile time. It takes so much longer to
compile, with larger amounts of code. Everything's included from header files,
and coupled so tightly it's a
How big does a project in Nim have to get, before re-compilation slows down to
a crawl with small modifications?
I know C barely slows down at all, by separating out a linking phase, so object
files can be prepared, and then re-linked quickly without needing to recompile
from source. But Nim
Nim/web/upload/system.html#readLine,File
"Returns false if the end of the file has been reached,"
Alright, no problem. Oh. Oh god you were right to insult me though.
proc foo(self: Bar) =
I make that mistake _all_ the time and I _never_ see it. :(
You could've just pasted only that line! :p
I'm not sure how to use the new {.this.} pragma, that lets us use shortcutted
syntax that adds in an implicit "this" when possible.
type Bar = object
baz: int
{.this: self.}
proc foo(self: Bar):
echo(baz)
foo(Bar(42))
> nim --experimental c
20 matches
Mail list logo