manual says: any: distinct auto (see below) but doesnt' actually elaborate;
what's the difference between any and auto?
they seem to behave the same with behavior: "bind many"
proc fn(a, b: auto)= # works
# proc fn(a, b: any)= # also works
echo (a,b, $type(a), $type(b))
[https://github.com/nim-lang/Nim/issues?q=label%3A%22symbol+resolution%22](https://github.com/nim-lang/Nim/issues?q=label%3A%22symbol+resolution%22)+
[https://github.com/nim-lang/Nim/issues?q=label%3A%22overload+resolution%22](https://github.com/nim-lang/Nim/issues?q=label%3A%22overload+resolution
@snej
* what is nim -v ?
(I'm assuming it's 1.2.2 but please double check)
* please post minimum reproducible example, otherwise it's hard to do
anything about your problem
also relevant: patchFile. I've actually been toying with the idea of replacing
patchFile with patchAst which would allow AST-level modifications instead of
source-level modifications, which are more robust. eg use case: for patching
3rd party (or even stdlib) code
partial answers:
* parseStmt + staticRead
*
[https://github.com/nim-lang/Nim/pull/9560](https://github.com/nim-lang/Nim/pull/9560)
same remarks as
[https://github.com/nim-lang/Nim/issues/14637#issuecomment-644338428](https://github.com/nim-lang/Nim/issues/14637#issuecomment-644338428)
the standard nim version is:
* more readable
* syntax highlights correctly
* interacts correctly with the rest of the language
* lead
there are use cases where you don't care about performance too much, or getting
the latest OS, for eg if you're simply trying to fix a bug that only affects an
OS, like the very flaky openbsd tioselectors bug
[https://github.com/nim-lang/Nim/issues/13166](https://github.com/nim-lang/Nim/issues/1
see also walkDirRecFilter since
[https://github.com/nim-lang/Nim/pull/14501](https://github.com/nim-lang/Nim/pull/14501)
but for now it's internal use only until API is deemed good
> I'd like to use nim to execute something like "C:UsersMeAppDataLocalThe
> AppTheApp.exe --uninstall --silent" or "bob" for short
did you mean:
"C:UsersMeAppDataLocalThe App\TheApp.exe --uninstall --silent"
Run
?
(you were missing the )
> execShellCmd(bob)
one questions is for generics, conditional compilation, and when templates are
in the mix which can complicate things.
> The extra line result = 0 or similar in the beginning of a proc
how about used(result); it's more generic and would work with any type, and
doesn't change semantics
this is probably what you're looking for
[https://github.com/citycide/glob](https://github.com/citycide/glob) but IMO
there should be something equivalent in stdlib
@yardanico that's a wrong, unrelated line number as you can see here:
when defined case2:
echo "ok0"
var i = ""
var u0 = 12
echo "ok1" ## <- line number points to here
const u1 = 12
var u2 = 12
i[10] = 'j'
echo i
Run
let
thanks for the super detailed guide!! curious though, is there a docker way?
docker run -it madworx/netbsd:8.0-x86_64 bash
this one-liner docker run -it phusion/baseimage bash gives you ubuntu 16.04
from osx, and (at least last week, but somehow not today), docker run -it
madworx/netbsd:8.0-x86
I wonder: nim could start supporting user defined litterals so you'd be able to
write:
import fusion/decimal128
echo -0.123'dec128 + 12e-4022'dec128
Run
nim parser would change to transform -0.123'dec128 into dec128("-0.123")
which feels more native (and would r
> I don't think this is true
it is true across the board; maybe there are some FP time libraries out there,
but the vast majority uses integral arithmetics over some unit (s, ms, us, ns
are typical)
* C (ctime)
* C++ (std::chrono, boost date_time)
* mongodb (int64 milliseconds since epoch
> I don't think the same issues apply to timestamps
the moment you're using FP as your internal internal representation you're
affected by FP semantics and the machine epsilon, eg:
* catastophic cancellation problem:
var a = 1.2
var b = a + 1e14
var c = b - 1e14
compiler docs used to be generated for a short while until
[https://github.com/nim-lang/Nim/pull/13509](https://github.com/nim-lang/Nim/pull/13509);
a few small things need to be addressed to re-enable compiler docs, which was
quite helpful, eg for nim-lang.github.io/Nim/compiler/ast.html (link
> > look at my stuff, my stuff is more important than all the other stuff by
> > all the other contributors
that's not the point at all, quite the opposite.
The whole point is for triaging PRs and saving reviewer time by allowing them
to filter from those 114 open PR's the ones that are in a re
agree with most points in top post except:
* float64 for timestamp
for the same reason as ppl don't use floating points for banking applications,
but instead use either integer in some units eg cents or fraction of cents, or
other fixed point arithmetics. floats will cause issues with round
Currently, looking at
[https://github.com/nim-lang/Nim/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc](https://github.com/nim-lang/Nim/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc)
it's not clear which PR's are ready for review vs still being worked on:
* using draft vs not draft is not good f
seems like you need special permissions to rerun from within azure pipelines UI
(eg
[https://dev.azure.com/nim-lang/Nim/_build/results?buildId=5365&view=results)](https://dev.azure.com/nim-lang/Nim/_build/results?buildId=5365&view=results\)),
which I don't have, since it's possible for a PR agai
I'd like to be able to re-run CI just for what needs to be re-run without
having to re-run everything to save CI cycles.
this works fine for sr.ht (if you have an account), and for github actions
(when it fails, IIRC you can rerun at least if project member), but somehow not
for azure pipelines
:
inspect resolveSymbol(`$`)
/Users/timothee/git_clone/nim/Nim_prs/tests/magics/tresolve_overloads.nim:134:35:
$ = closedSymChoice:
/Users/timothee/git_clone/nim/Nim_prs/lib/system/dollars.nim:10:1 proc
`$`(x: float): string {.magic: "FloatToStr", noSideEffect.}
/User
my understanding is that this Builtin optional type is dead code and should be
removed, which matters a lot because TTypeKind.high == 63 I'd like to add a new
TTypeKind without making set operations on types slower (although this should
be benchmarked to see if it matters or not)
please check github issues first :) it's already tracked here:
[https://github.com/nim-lang/Nim/issues/13999](https://github.com/nim-lang/Nim/issues/13999)
see also
[https://github.com/pragmagic/karax](https://github.com/pragmagic/karax) which
uses a virtual DOM, but is production ready.
finally found a nim package that works on OSX, see also a comparison:
[https://github.com/paul-nameless/nim-fswatch/issues/1](https://github.com/paul-nameless/nim-fswatch/issues/1)
@Hlaaftana CT getTime now possible via {.push experimental: "vmopsDanger".}
since
[https://github.com/nim-lang/Nim/pull/13813](https://github.com/nim-lang/Nim/pull/13813);
see example in that PR
\--warningAsError[X]:on|off|
---|---
[https://github.com/nim-lang/Nim/commit/9c46927fad6535cf7e172f5af5e93d179cec1020](https://github.com/nim-lang/Nim/commit/9c46927fad6535cf7e172f5af5e93d179cec1020)
/cc @jgeralnik|
---|---
> On second thought - not sure how well this could possibly work. When
> compiling my stand alone utility I pass in: --passL:"-lpcap" so that my
> binary will like against pcap, but if I want this code to run in compile time
> I need to either link the compiler to
=> I filed it here:
[https://github.com/nimterop/nimterop/issues/171](https://github.com/nimterop/nimterop/issues/171)
## staticExec is wrong approach staticExec is a bad approach to solve this kind
of problem more generally (whether it's for regex, rand, getTime, and hosts of
other things that require importc procs).
* large performance overhead (especially if what you need is something that
measures time, w
I think this is an important special case that nim doc should handle, so that
these 2 cases work:
proc fun1*() = discard ## doc comment for `fun1`
proc fun2*() = discard
## doc comment for `fun2`
Run
I had a PR for that but krux02 closed it (see
[https://github.com/nim-lang/Nim/pull/9560)](https://github.com/nim-lang/Nim/pull/9560\));
I've been using it (and subsequent improvements of it) in my own patched nim
compiler and it is very useful; one use case is enabling things like nim doc in
u
> It's known at compile time as int32
int, not int32
> It's known at compile time as int32, not iX, while nim compiler totally
> ignores this and assume they are compatible. But they aren't. [...] the more
> sane option is not provide a subrange type in the first place.
again, not-a-bug. 2.int
[https://travis-ci.org/nim-lang/Nim](https://travis-ci.org/nim-lang/Nim) still
shows at least travis is still in use; and it translates in a badge saying
build failing or passing on
[https://github.com/nim-lang/Nim](https://github.com/nim-lang/Nim)
Do we need .travis+appveyor in nim repo now that we have azure-pipelines?
can we remove these?
This leads to odd cases where PR's are green but nim's build is broken, since
nim's build (triggered on PR merge IIUC) runs on travis+appveyor (at least) but
PR's run azure-pipelines (+freebsd buildsh
@Somerandomguy
> I mean this does compile, seems like I'm a bit too emotional last morning
type iX = range[1..5]
var a: iX = 3
let b = 10 # will give RT error
# const b = 4 # will work
# const b = 10 # will give CT error
a = b
Run
not-a-bug. it will
you may want to search in forum for similar questions before opening a new
thread (which fragments discussion) => duplicate of [interest in a decimal
library - Nim forum : interest in a decimal library - Nim
forum]([https://forum.nim-lang.org/t/5687](https://forum.nim-lang.org/t/5687))
also you
* for use in stdlib, IMO nre is the better design
* for use outside stdlib, IMO pkg/regex has a better design, eg works at CT,
and is pure nim code without pcre dependency; I'm curious about performance,
haven't seen benchmarks on this
@Stefan_Salewski @Nam > It`s a bit hard to believe that this is a serious
question because of > But maybe you missed that and have no CS experience. >
That is not a Nim issue, but occurs from representation of floats in the CPU
it's a serious question, no need to question about OP's CS credentia
oups, guess I'm a bit late; I tried to fill
[https://nim-lang.org/blog/2019/12/20/community-survey-2019.html](https://nim-lang.org/blog/2019/12/20/community-survey-2019.html)
but it says it's closed; any chance to re-open? otherwise no big deal
* @moerm regarding not blindly ignoring warnings, I completely agree and in
fact after
[https://github.com/nim-lang/Nim/pull/11591](https://github.com/nim-lang/Nim/pull/11591)
is merged you'll be able to show c/c++ warnings (see that PR for rationale +
bugs it helped uncover)
* I second
for C/C++ structs, the binary layout is different from the PNode binary layout
of a compile time object instance, so you can't just deref a ptr Foo returned
by a importc proc (that wouldn't make sense); and thankfully the compiler
prevents it.
However you can access individual fields via access
> What in particular needs work on Windows 64bit?
libffi bindings only support win32, not win64; maybe a solution is to use a dll
for win64 instead of embedding the sources, see
[https://github.com/Araq/libffi/blob/master/libffi.nim#L14](https://github.com/Araq/libffi/blob/master/libffi.nim#L14)
I've been using it extensively ever since the feature was introduced, it's a
very useful feature and works well. Feel free to upvote
[https://github.com/nim-lang/Nim/pull/13091](https://github.com/nim-lang/Nim/pull/13091)
which re-enables testing this feature in CI, to prevent future regressions
it just got merged
after
[https://github.com/nim-lang/Nim/pull/13249](https://github.com/nim-lang/Nim/pull/13249)
you'll be able to do:
nim dump --dump.format:json . | jq -r .libpath
/Users/timothee/git_clone/nim/Nim_prs/lib
Run
(for jq, use for eg: brew install jq)
following example is even more drastic, 3x speedup over C++ (in case where
there are a lot of thrown exceptions)
import std / [times, monotimes, stats, strutils]
const depthRaise = 100
type MyExcept = object of CatchableError
proc fib(m: string, depth = 0): int =
this might be of help too (adapting some ideas from D to nim):
[adamdruppe/d_android: Helper programs and interfaces for using D on Android
systems : adamdruppe/d_android: Helper programs and interfaces for using D on
Android
systems]([https://github.com/adamdruppe/d_android](https://github.com
=> see PR
[https://github.com/nim-lang/Nim/pull/12907](https://github.com/nim-lang/Nim/pull/12907)
Well, the article was published this morning, here it is:
[https://www.theregister.co.uk/2019/09/24/nim_version_10](https://www.theregister.co.uk/2019/09/24/nim_version_10)/
thanks; I've updated the wording in the C++ interop paragraph
I was asked to comment on the following for an article: > Nim has just reached
1.0 and I was wondering whether you might be willing to comment on why Nim is
useful and where it fits into the continuum of programming languages?
Here's my tentative response; feedback is welcome:
Nim gives you the
related: [parseHtml does not work (eg: can't find any div) in presence of
Curious about who's using Nim in SF / bay area, and whether there'd be interest
in organizing a meetup / FB group. If there's enough interest I could set up
one.
I've implemented this in
[https://github.com/nim-lang/Nim/pull/11865](https://github.com/nim-lang/Nim/pull/11865)
> Will you alias work for the result variable too? Would be great -- I had
> often procs like
it works, I just added a test case for that see
[https://github.com/nim-lang/Nim/pull/11822/files#diff-ef6ec6154188e96632ac5bf114a7c1faR131](https://github.com/nim-lang/Nim/pull/11822/files#diff-ef6ec61
properly fixed here:
[https://github.com/nim-lang/Nim/pull/11822](https://github.com/nim-lang/Nim/pull/11822)
nim has a real alias that works with any symbol #11822
proc getLength(i: int): int = sizeof(i)
proc getLength(s: string): int = s.len
# const length = getLength # Er
with this PR
[https://github.com/nim-lang/Nim/pull/11754](https://github.com/nim-lang/Nim/pull/11754)
we can do it as follows:
dispatch foo:
for a in 0..<3:
echo a
echo 10
Run
Is there a way to have optional params before an untyped body in
templates/macros?
The last case gives an error, that's the one I want:
template foo(a1 = 10, a2 = "", body: untyped) = discard
# works
foo(3, "asdf"):
for a in 0..<3:
echo a
echo 10
this PR by @krux02 will fix this:
[https://github.com/nim-lang/Nim/pull/11286](https://github.com/nim-lang/Nim/pull/11286)
(Allow void macro result)
@moerm > Thanks for the hint! Now with the "trick" setting a breakpoint
at a proc does work
if you need to script this, (gdb) rbreak main_ or (lldb) br s -r main_ for
regex breakpoint (ie that works with mangled names)
this helped me before: import segfaults
it inserts a signal handler and outputs a stacktrace.
=>
[https://gist.github.com/rayman22201/92f28f0c1d9ccbc5a36fe04c2132c49e#gistcomment-2811762](https://gist.github.com/rayman22201/92f28f0c1d9ccbc5a36fe04c2132c49e#gistcomment-2811762)
can u show a minimal reproducing example?
I often see @araq write in this style:
$nimc_D/compiler/layouter.nim: [1]
discard "do nothing, see #9499"
return
Run
is there any semantic difference with: [2]
discard # do nothing, see #9499
return
Run
or even [3]
original article:
[https://atilanevesoncode.wordpress.com/2018/12/31/comparing-pythagorean-triples-in-c-d-and-rust](https://atilanevesoncode.wordpress.com/2018/12/31/comparing-pythagorean-triples-in-c-d-and-rust)/
here's nim version I proposed: see
[https://github.com/atilaneves/pythagoras/pull/
tracked here:
[https://github.com/nim-lang/Nim/issues/10088](https://github.com/nim-lang/Nim/issues/10088)
building from source on windows: instructions lack necessary details and lead
to errors #10088
see
[https://github.com/nim-lang/Nim/issues/10088#issuecomment-449787627](https://github.com
=> PR
[https://github.com/nim-lang/Nim/pull/10011](https://github.com/nim-lang/Nim/pull/10011)
seems related to
[https://github.com/nim-lang/Nim/issues/9953](https://github.com/nim-lang/Nim/issues/9953)
/cc @araq @alaviss
in your top-level example, when I use:
let p = startProcess("{file_b2}", options = {{poParentStdin}}) (right now,
pending my updating PR, I call it poParentStreams, ov
https://github.com/nim-lang/Nim/pull/9846
maybe we could add a naive topN based on sort + slice last N elements, so
clients can start using that, and then they'd benefit when a proper topN is in
stdlib
## example implementations
*
[https://dlang.org/library/std/algorithm/sorting/top_n.html](https://dlang.org/library/std/algorithm/so
see also: [astToStr(arg) inserts spurious newline for fun:arg · Issue #9719 ·
nim-lang/Nim]([https://github.com/nim-lang/Nim/issues/9719](https://github.com/nim-lang/Nim/issues/9719))
can you show a minimized example where it fails?
I'm not talking about the name of devel branch but about semantic versioning
typically, symver assumptions is that patch version is increased for bug fixes;
they shouldn't introduce breaking changes;
right now devel (with NimMajor.Minor.Path = 0.19.9) keeps introducing breaking
changes on the s
this commit b4f16fab498ae705532391d7f57481197972d70f changed from 0.19.1 to
0.19.9
this doesn't make sense to me. What would make sense would be to change from
0.19.1 to 0.20.0
if we want to backport critical bugs to 0.19.X, they can be backported to a
branch hotfix/0.19.2 until a new tag 0.19
*
[https://github.com/nim-lang/Nim/issues/8927](https://github.com/nim-lang/Nim/issues/8927)
seems very promising but no idea what's ETA on having it as a viable option
* all the other options mentioned have limitations, eg javascript/wasm and
nimscript offer a subset of what Nim can do; and
actually if anyone can help with this bug it would really help:
[how to reload NimLime without re-opening sublimetext? · Issue #115 ·
Varriount/NimLime]([https://github.com/Varriount/NimLime/issues/115](https://github.com/Varriount/NimLime/issues/115))
ok, find the fix:
[https://github.com/Varriount/NimLime/pull/114](https://github.com/Varriount/NimLime/pull/114)
I just posted it here [nothing works, eg: nimcheck output is run but doesn't
show anything (even if there are obvious errors) · Issue #113 ·
Varriount/NimLime]([https://github.com/Varriount/NimLime/issues/113](https://github.com/Varriount/NimLime/issues/113))
but the problem has existed since ~j
> it can use more memory than a "naked" switch
that doesn't make sense to me; it would be a array (ie compile time length), so
would only use stack allocation; furthermore I don't see how switch would use
less stack memory
well not sure it's only for "interpreter loops" ; seems to be applicable any
time you have a switch on a finite range (eg enum; maybe also 8 bit integers in
case all integers are specified);
so the question remains: is there any disadvantage to always turn on this
optimization? (which as I ment
/cc @araq|
---|---
correct; it's simpler than traditional gitflow because in gitflow we must know
in advance where a bugfix PR goes (is it v1? is it v2? is it 0.18.x branch? is
it 0.17.x release? ) which is often not practical (especially when PR contains
multiple commits, only one of wh
@araq
> That is what we like to do though, if not for the upcoming 0.19.2 vs 0.20
> split, then later for the v1 vs v2 split, so we might as well figure out how
> to do it now.
IIRC the article mentions how to adapt the model to handle that case (eg for
python2 vs python3, or in our case nim1
Are there any disadvantage to using computed goto ? (I'm not aware of any but
could've missed something)
If not, why not make {. computedGoto.} implied automatically for all switch
statements over enum (or finite range) variables (see
[https://nim-lang.org/docs/manual.html#pragmas-computedgoto-
/cc @araq @kaushalmodi|
---|---
We've recently agreed to use a branch based development as opposed to trunk
based, see
[https://github.com/nim-lang/Nim/issues/7527](https://github.com/nim-lang/Nim/issues/7527)
([RFC] Nim development and release model - 1.0 and beyond #7527) and are now
the cfg macro would be nice indeed. solves all the problems IMO
speaking for myself here, but I don't think the (main) concern of the 'keep
cfg' camp is that the syntax is different between \--hint[LineTooLong]=off
(cfg) and hint("LineTooLong", "on") (nims) as that's easy to switch to (and we
can write a tool to automate if needed), their main concern is the
ok thanks; indeed
`foo`:idx:
Run
will end up in an entry in
[https://nim-lang.github.io/Nim/theindex.html](https://nim-lang.github.io/Nim/theindex.html)
It would be nice if docsearch would also find it, and the foo would result in a
link instead of plain text
@arnetheduck @ juancarlospaco
To misquote Jamie Zawinski's Law, "every declarative config language attempts
to expand until it can read mail. Those which cannot are replaced by ones which
can."
Joking aside, declarative config style may be fine for the simplest projects,
but in more complex ca
see context in this commit:
[https://github.com/nim-lang/Nim/commit/37986d0ba8d83b76e710b352a7da7cce2a5cb157](https://github.com/nim-lang/Nim/commit/37986d0ba8d83b76e710b352a7da7cce2a5cb157)
typetraits.nim defines:
proc supportsCopyMem*(t: typedesc): bool {.magic: "TypeTrait".}
nimble packages should standardize on a build directory for generated files, to
keep git status clean
## proposal
* nimble init should create a build dir, in addition to what it already
creates (src, tests, foo.nimble)
* it should also add a .gitignore file with contents:
/b
everything that can be done with nim.cfg can be done with config.nims (after a
number of issues were fixed in past few months), and config.nims is also much
more featureful, so the question is:
should we deprecate nim.cfg in favor of config.nims format?
## arguments for deprecating nim.cfg
*
=> tracked here:
[https://github.com/nim-lang/Nim/issues/9253](https://github.com/nim-lang/Nim/issues/9253)
example: exponential compile time reported here :
[https://github.com/nim-lang/Nim/issues/9422#issue-371425191](https://github.com/nim-lang/Nim/issues/9422#issue-371425191)
@ThomasTJdev7h @mikra
what I meant was supporting something like this:
var i_am_nil: Option[string] # this will be none
var i_am_not_nil: Option[string] = some("foo") # this will be none
discard insertID(db, sql"INSERT INTO myTable (name, name2) VALUES (?, ?)",
i_am_nil, i_a
I'd really prefer doing like what github does with its search bar, see
[[docgen] allow github-like search syntax · Issue #9431 ·
nim-lang/Nim]([https://github.com/nim-lang/Nim/issues/9431](https://github.com/nim-lang/Nim/issues/9431))
eg:
find limit:30
Run
could API's be changed to accept Option[string] ? (likewise with seq) Seems
like a clean way to handle nil.
/cc @araq @arnetheduck @dom96 @miran|
---|---
We need a decision on this soon, or, if more time is needed, at least lock (see
[https://help.github.com/articles/locking-conversations/](https://help.github.com/articles/locking-conversations/))
in the meantime the duplicated exported issues
1 - 100 of 202 matches
Mail list logo