would be nice to be possible (for Nim dev team) to pin a post at the top of the
list on the forum. this one would be a good candidate, at least for a few
weeks...
Try from the command line nimpretty file_to_format.nim and see if that works?
Unfortunately that doesn't seem to work for me; I still get
#line 99 "generated_not_to_break_here"
Run
In fact with `-d:release` I also get
#line 189 "iterators.nim"
Run
as a relative path as well as the correct absolute path in the
Is this what you did?
let line = discard client.recvLine()
Run
If so, then: @[anyone else] That should be a bug, shouldn't it?
`await` gets you the content of a `Future`.
`discard` just discards whatever you pass as argument.
`proc` with `{.async.}` always return `Future`.
(usually compiler wont let you just discard/not use stuff).
`-d:release` wont generate those, not sure I understand tho... 樂
I will, thank you all for the support :).
`for v in users: for name, value in fieldPairs(v[]): echo(name, "=", value) `
Run
The Nim compiler is putting lines like this into the generated C code:
#line 99 "generated_not_to_break_here"
Run
This is breaking `coco`, which uses `lcov` by causing it to try to process the
file `generated_not_to_break_here`, which doesn't exist.
Is there a
That's probably a bit beyond me, or at least the level of time I want to invest
to get this to work tomorrow. Still I look at the example that prints out the
dimensions of the screen and dream I might work out how to call that.
Wow
server.bindAddr(Port(9000))
Run
`server` gets passed to the first argument in the background? Then in my case,
the next argument is port, which is the first argument. Interesting, but very
confusing at first.
Can I compile nimpretty on Windows? Is there a guide?
Example code:
type
Client = ref object of RootObj
name: string
user_id: int
var
users: seq[Client]
users.add( Client(name: "george", user_id: 1) )
for v in users:
echo v.name
Run
For example,
read the tutorial/manual.
[https://nim-lang.org/docs/tut2.html#object-oriented-programming-method-call-syntax](https://nim-lang.org/docs/tut2.html#object-oriented-programming-method-call-syntax)
Your `server` is `AsyncSocket`.
You can pass `port = Port(9000)` too.
Nim is style agnostic.
`bindAddr(server, Port(9000))` will work too.
echo "a"
echo("b")
echo"c"
"d".echo
"e".echo()
Run
Nim has
just compile it yourself and place its binary in PATH. its sources are included
with nim.
@miran Thanks for the update. In the meantime, are you on windows? Or is there
anyone here that can send me their nimpretty executable? I'm on a roll with
nim, I really like the syntax so far.
I'm not aware of any packages that do this, but you can write your own.
The WinAPI is fairly straightforward to use once you get the hang of it, I and
many others I'm sure are happy to help as well. This is likely what you want:
@miran sorry for late reply, cause an image worth thousand words here are the
images.
[Images Gallery](https://postimg.cc/gallery/2ikttr5ei/)
regarding TOC, I meant navigating through TOC using Kindle Go to option in the
Toolbar. Normally it should list all the heading and subheading of the
> const dont need all uppercase names anyway.
That is my style, I like my const names all uppercase
`bindAddr` has 3 parameters AFAIK, socket, port and address, correct? How come
simply passing in `Port(9000)` works, instead of `port = 9000`?
I'm following the parameter guide from
Hi, another nim newbie here. I was looking for a way to show the available
system memory for Windows OS. My research took me as far as the psutils
package, and then I started sobbing when I read "Linux only". Is there anything
else I can use, like a way to query windows counters with nim. If
It is a known problem, and we will fix it (ship nimpretty with Windows version)
for v1.0.2 coming out next week.
Your `PORT` is colliding with `Port`, it literally says that, `const` dont need
all uppercase names anyway.
Your `server` is a socket. Check `nimpretty` and `nim check --styleCheck:hint`
on the terminal.
const portNumber = 9000
server.bindAddr(Port(portNumber))
Run
Because most of the linked pages are unmaintained. TLDR is pretty maintained
sin people can contribute to it.
Licenses are restrictions.
You have licenses like WTFPL which mentions no restrictions, then software is
Proprietary for the law.
Just like a software with no license is proprietary
> (heap overlaps stack, so one function jump outside one's bound).
That seems very improbably. It's more likely that you have a stack overflow and
while writing a stack variable you also overwrite the return instructions of
your function.
Is your code open-source?
If you compile your code
I'm an avid Crystal user. And I just stumbled upon these videos, heck yeah.
This language's syntax is freaking awesome I'm falling in love with it. Please
continue to do more tutorials
I downloaded the Windows version of nim here:
[https://nim-lang.org/install_windows.html](https://nim-lang.org/install_windows.html)
Installed the nim extension, but when I save my files, I receive an error:
> No 'nimpretty' binary could be found in PATH environment variable
I can't find any
#10 is live at: [https://youtu.be/AtLz9Q_pcNM](https://youtu.be/AtLz9Q_pcNM)
Longest one so far.
Nice. I thought it had to do with pointers, references, etc. I was like omg lol
I tries to rewrite my project, called progress: call to power (game based on
Freeciv) to nim, because I have memory problems (heap overlaps stack, so one
function jump outside one's bound).
I tries different approach. First was adding nim.cfg given bellow:
cincludes:../c-files/common
Example:
var
users* {.threadvar.}: seq[string]
Run
I'm brand new to nim. Just heard about it today and I'm in love with the syntax.
I googled but couldn't find anything. I think I read it was something to do
with exports, but not sure?
I might need a copy-on-write implementation, and was wondering if this is still
a good way.
Am I right in thinking that this will only work with the refcount gc, and not
with the new (owned/bd) or alternative (mark & sweep, boehm, regions) gcs?
> The GC and memory management between nim, c, and switch would be a constant
> pain point. You would have to export c style structures. It might even make
> sense to write the header file in C as glue and have both nim and swift use
> it.
I will have time in a couple of weeks to try this. I
Looks disgusting, sorry.
I finally wrote a quick wrapper for gzfile that looks a lot like nim's File.
You can use like
import gzfile
import strutils
var vcf:GZFile
doAssert vcf.open("test.vcf.gz")
for line in vcf.lines:
if not line.startsWith('#'):
# do something
Thanks for your extensive reply!
I think I see where our misunderstanding comes from. As I understand, you're
seeing the term "open source" literally from the perspective of an individual
user. In contrast, my perspective is that of a software maintainer picking a
license for their publicly
The reason why I think the Peer Production License doesn't comply with the open
source definition (point 5) is that, even though the license doesn't restrict
_all_ commercial use, it restricts _some_ commercial use (point 4 c and d).
This isn't visible in the boxes at the top of the respective
Wonderful!! ill check it out when i have more time
You can as long as a_proc and b_proc has exactly the same type signature.
Is it possible to put the procedure into table's value, and be dispatched like
python dictionary?
var dispatch_table = {"a": a_proc, "b": p_proc}.toTable
Run
it looks like im getting this error:
Error: invalid type: 'None' in this context: 'proc (s: var
[https://tldrlegal.com/license/mit-license](https://tldrlegal.com/license/mit-license)
↔️
[https://tldrlegal.com/license/peer-production-license](https://tldrlegal.com/license/peer-production-license)
Well, then... call that "not-legally-usable-for-some open source" :).
Or "with restrictions". Though seems the only restriction about the sources
themselves is "You must not distort, mutilate, modify or take other derogatory
action in relation to the Work which would be prejudicial to the
> there is no way to upload images in the forum
If you could upload them to [imgur](https://imgur.com/) or any other
image-sharing site, and then post links here, it would be really helpful for me
to see what is going on. (I'm not seeing that in Calibre)
> Table Of Contents doesn't work as
> The definition of open source at opensource.org seems to be quite
> restrictive; by common sense, sources are open, if just are freely
> accessible, in the original, non-obfuscated form.
In this case common sense is not correct. Making sources available online does
not provide legal rights
@miron Many thanks for your time and effort. I scanned through the book on my
kindle paper white (actually its pretty and old one. Generation 1)
Things that took my attention:
1. Table Of Contents doesn't work as expected.
2. There is extra space everywhere.
I took some pictures but it
> non-blocking
The StatsD protocol is also used over TCP, not just UDP:
[https://github.com/statsd/statsd#statsd](https://github.com/statsd/statsd#statsd)\--
It may also depend on how "standard" the desired string is whether @jasper's
solution is enough for @cnuzzi. Usually, the setuid, setgid, sticky bits have
some `'s'` or `'t'` substitutions for the `'x'`, and capitialized `[ST]` if one
of those bits is set but the corresponding execute
OK:
$ nim -v Nim Compiler Version 1.0.99 [Linux: amd64] Compiled at 2019-10-03
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: c51857f4348823f647110e8a1ede07d76d93b7da active boot switches:
-d:release
The chess game compiles and runs fine for me still. But I can test only on 64
bit linux,
No, no reason -- but my last update was only two weeks ago. Will update now,
but will not test all my packages again. Have first to finish tgs bulk loading
for my RTree, and maybe then make a nimble package out of it. So testing other
packages have to wait, maybe next year.
There's also a lightweight StatsD-only library: statsd_client
[https://github.com/FedericoCeratto/nim-statsd-client](https://github.com/FedericoCeratto/nim-statsd-client)
> `nim -v Nim Compiler Version 0.20.99`
Is there a reason why you didn't update to v1?
Yes, it didn't work. However the graphics on the picture was really nice,
almost like the standard chess board just nicer looking. And 1400 lines for a
fully functional chess game is really cool.
:/ So, I [tried to add a
test](https://github.com/akavel/macromatch/blob/c494cd6b2e141323895417da77fb101517583478/tests/test1.nim),
but it doesn't really seem to work with the usual approach in a `static:`
block:
$ cat tests/test1.nim
import unittest
import macros
Hi would you please provide an EPUB format along with other formats as well?
Diversity of choice is a thing which is always respected.
I hope Dom takes time to provide its book readers with an update page. I'm
reading the book and enjoying.
> Mirans tutorial is available as PDF and HTML, it is based on Asciidoctor,
> maybe you can generate epub yourself.
If there is a need for .epub format, I can see if I can make one officially
available.
This version does type-checking (correctly pointing to procedure definition),
and allows that simple method invocation syntax.
type
BinaryTree*[V; cmp: static[proc(a, b: auto): bool]] = object
# different ways of providing a procedure
# an `echo` is added to each
Dom's book was available in ebub format from the beginning, I read the early
drafts in epub.
Note hat the book is not needed to learn Nim, there are many great resources
for beginners now:
[https://nim-lang.org/learn.html](https://nim-lang.org/learn.html) The book is
a nice to have, for some
Or use the posix.nim module for this.
59 matches
Mail list logo