Top-level variables are globals and so not optimized by the compiler and also
never released if they do allocate. They are fine for quick scripting or quick
prototyping.
Similarly, top level statement are not optimized.
So it's more of a performance issue than correctness issue. That said, read
The usual recommendation for CPU intensive task is to use Rayon. Tokio is
ill-suited even if it uses a threadpool underneath.
The role of the threadpool is to avoid the overhead of create/teardown thread.
What makes a multithreading runtime suitable for IO or CPU is its scheduler.
The Tokio sch
This question reads like
"I want faster horses for my carriage" while someone is building a car.
That seems to have done it. Would this be considered an "issue" as far as the
language goes? GitHub documentation states that a delete request should return
`204 No Content`, but not sure if the code is returned or if, literally,
nothing (nil) is returned.
Thanks for the pointer to the other pr
The proc does what it says in the documentation and is consistent with the
other procs for requests.
> Connects to the hostname specified by the URL and **returns the content** of
> a DELETE request.
Have you tried using just `delete` instead of `deleteContent`? The procs ending
with `Content` always return the body.
Note that a segmentation fault can't be `except` ed because it's not an
exception.
`deleteContent` question ... I'm sending a `deleteContent` request to GitHub
and successfully deleting a repo. However, after it deletes the repo, I get
these errors a list of errors that ends with these:
C:\Users\\.choosenim\toolchains\nim-1.4.0\lib\pure\httpclient.nim(1108)
del
> Also, the compiler doesn't like top level statements, you should put the for
> loop into a proc.
Can you elaborate on that? Is that still the case today?
On the off change that @dom96's advice to use async was part of the problem. I
converted it to async:
import asyncdispatch, asyncnet
import std/[net, selectors, strformat, strutils]
const
cfgMaxPacket = 500
clientPort = 8800
clientHost = "127.0.0.1"
Anyone know why I cant seem to use `sendTo` for an off-machine address? Using
@jrfonden 's example above, if I set the `sendTo` address to `192.168.1.44`
which is the machine I'm on, it works just fine. (Especially if I'm also
running the UDP server on my local machine.)
But, if I set the addre
Your example doesn't compile, in would have to be
discard x := (y := 3)
Run
Exactly!
Nim isn't C, `x = y` could have complicated behavior, so it's best that it
stays void. You could define the walrus operator in Nim with a template like so:
template `:=`(a, b): untyped =
let a = b
a
x := y := 3
while (y := fct(x)) > 0:
discard
But you can easily do that in Nim already:
while (let y = fact(x); y > 0):
Run
There is one thing I'd like to add to the _wish list_. It's a personal(!)
preference.
Sometimes it's called _orthogonality_ , or in simple words: _what makes sense,
should be possible_.
Of course, it's hard to define _what makes sense_. An example is "things that
are thought being passable to
> @nocturn9x: Could you elaborate a bit on why this is a bad design choice? It
> is indeed debatable, also because in general python violates the general rule
> of "exceptions should be used for exceptional behaviors", but not outright
> wrong
The quote from your own message already answers you
Just as a side note, I agree that trying to make nim become python is dumb.
People need to understand that nim is not compiled Python, it's an awesome new
language, but since they see some similar behavior they tend to jump to this
wrong conclusion. The thing I do not agree with is Python, or dy
Could you elaborate a bit on why this is a bad design choice? It is indeed
debatable, also because in general python violates the general rule of
"exceptions should be used for exceptional behaviors", but not outright wrong
Well, regarding the `3 < "abc"` thing, at least the Python development team had
the guts to deprecate that behavior in the new versions of Python (looking at
you Javascript 😂)
Congrats! Hope everything works out for you! In about a year I'm going to need
your services.
Yes, you are right. This is the standard rounding in IEEE 754. I suppose that
with this rounding, errors in one direction better compensates errors in
another direction.
Just a comment w.r.t. rounding. The Python way is THE accepted way of rounding
in Numerical Analysis! Always rounding n+0.5 (where n is integer) up is biased
and makes problems. People have computed long time astronomical calculations
and they experienced that our planets leave our solar system.
I have updated eminim with an
[jsonItems](https://github.com/planetis-m/eminim#the-jsonitems-iterator)
iterator, that reads a top-level JSON array file.
type
IrisPlant = object
sepalLength: float32
sepalWidth: float32
petalLength: float32
petalW
...or the ability to work on Windows.
25 matches
Mail list logo