Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
From IRC (bridge bot)
@FromIRC
<FromDiscord> <lqdev> that's a good idea
<FromDiscord> <lqdev> i'm quite surprised it doesn't support them
<FromDiscord> <lqdev> probably an oversight
<FromDiscord> <lqdev> @HJarausch_gitlab can you open an issue on github?
<FromDiscord> <haxscramper> https://play.nim-lang.org/#ix=2F5K
<FromDiscord> <haxscramper> It does support set[T]
<FromDiscord> <haxscramper> But again, you need to use some non-obvious proc initSet[A](): set[A] = discard thing
<FromDiscord> <haxscramper> Which does not come with stdlib
From IRC (bridge bot)
@FromIRC
<FromDiscord> <haxscramper> I can add initSet too - will be PR'ing items for iterator(): T anyway so
<FromDiscord> <haxscramper> Although I don't know where I should put it exactly. newSeq is in std/system, probably makes sense to add initSet too.
Helmut Jarausch
@HJarausch_gitlab
@FromDiscord I've tried to adapt your example (https://play.nim-lang.org/#ix=2F5R) but is crashes Nim 1.5.1 git hash: d9038ed792b923cfbb9593ab82825fdb48728adc)
From IRC (bridge bot)
@FromIRC
<FromDiscord> <lqdev> @haxscramper imo something like collect(set[uint16] {}) should be supported too
Helmut Jarausch
@HJarausch_gitlab
I've fixed my example https://play.nim-lang.org/#ix=2F5T but it still crashes
From IRC (bridge bot)
@FromIRC
<FromDiscord> <lqdev> btw @HJarausch_gitlab, FromDiscord is the bot that bridges discord to IRC and Gitter. if you want to ping any of us, use the name in <> in the bot's message
<FromDiscord> <haxscramper> nnkCall, nnkIdent, nnkSym - @HJarausch_gitlab you can only use identifier or call in collect argument
<FromDiscord> <haxscramper> E.g. you probably expect it to work like this, but not it is not supported. But probablt should be though,
<FromDiscord> <haxscramper> Becase it took me a good 10 minutes to figure out how return types are derived from argument+body
<FromDiscord> <haxscramper> E.g. collect(seq[int]) is perfectly reasonable way to write things
<FromDiscord> <haxscramper> Well, not 'reasonable', but I can clearly see how someone tries to do this
<FromDiscord> <lqdev> the details are revealed if you use collect(set[uint16]({})) - it does set[uint16]({})[typeof(<body>)]
<FromDiscord> <lqdev> but you have to have an understanding of macros to actually know what the error message means
<FromDiscord> <haxscramper> If only expandMacros worked for malformed code. But I guess it is quite hard to do right in the first place
咚咔
@cupen
Sorry, I have a new stupid question. why it's a syntax error?
proc new*(url: string): Benchmarks =
  var u = uri.parseUri(url)
  var obj = Benchmarks(url:url, host:u.hostname, port:parseInt(u.port).Port)
  obj.client = redis.open(host=u.hostname, port=parseInt(u.port).Port)
  obj.init()  # Error: attempting to call undeclared routine: 'init'
  return obj

proc init(this: Benchmarks): void =
  var key = "nim_redis:test"
  var val = "Hello World"
  this.client.setk(key, val)
  var resp = this.client.get(key)
  assert resp == val

oh, I see.

proc init(this: Benchmarks): void =
  var key = "nim_redis:test"
  var val = "Hello World"
  this.client.setk(key, val)
  var resp = this.client.get(key)
  assert resp == val


proc new*(url: string): Benchmarks =
  var u = uri.parseUri(url)
  var obj = Benchmarks(url:url, host:u.hostname, port:parseInt(u.port).Port)
  obj.client = redis.open(host=u.hostname, port=parseInt(u.port).Port)
  obj.init()
  return obj

this would be ok.

Helmut Jarausch
@HJarausch_gitlab
Oh well, yet another problem. If I invoke Nim as
nim c -d:DEBUG:true -r mytest.nim
how can I get at the value of 'DEBUG' within a 'when' clause in mytest.nim?
Checking
when defined(DEBUG)
works.
<FromDiscord> <haxscramper> But I would recommend to avoid SCREAMING defines, and use -d:debug + when defined(debug)
From IRC (bridge bot)
@FromIRC
<Zevv> does "result" vs "return" help with RVO optimizations?
<Zevv> oh wait, drop the last word, that's redundant
<FromDiscord> <Rika> It should, yes
<Zevv> I've been trying to make a practical example where I can see one performs better then the other, but I have failed up to now
From IRC (bridge bot)
@FromIRC
<Zevv> oh wait I can
<Zevv> but it's so trivial that I would have expected Nim to figure that on out
<Amun_Ra> Zevv: there's a third way: a value alone
<Zevv> sure
<Zevv> but I was wondering why Nim did not pick up a simple single assignment and return
<Amun_Ra> hm
From IRC (bridge bot)
@FromIRC
<Zevv> doesn't make sense to run that in debug mode tho
Alexander Ivanov
@alehander92
Araq
From IRC (bridge bot)
@FromIRC
<Zevv> With the C++ backend the 3d option is twice as slow
Alexander Ivanov
@alehander92
ok i pushed
From IRC (bridge bot)
@FromIRC
<Zevv> as the other ones
Alexander Ivanov
@alehander92
a fixed old version
you can merge this .. eventually as an alpha
if it looks ok enough and if we fix the CI
it seems my strictnotnil enabled tests pass locally, but i am not sure why i had fails there, have to debug now
From IRC (bridge bot)
@FromIRC
<Zevv> strictnotnil sounds like some kind of italian type of pasta
<Zevv> or a new covid vaccin with at least 96% success rate