Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 04 12:26
    @dom96 banned @acroobat
  • 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> 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
Alexander Ivanov
@alehander92
this one doesn't include the optimized no-set-alias / or eventually newer stuff
which can be added later
and no smart return value analysis
From IRC (bridge bot)
@FromIRC
<Zevv> dude you are really getting that done
<Zevv> that is very nice
Alexander Ivanov
@alehander92
so result = (a, b) can still lead to a bug on theory
(and in practice*)
but all this can be .. fixed later this year hopefully
zevv i literally just went to the original september branch
rebased and fixed a little and just enabled 1-2 more tests
From IRC (bridge bot)
@FromIRC
<Zevv> but you got a long way with that right?
Alexander Ivanov
@alehander92
and removed some comments
From IRC (bridge bot)
@FromIRC
<Zevv> it's not wrong IIRC?
Alexander Ivanov
@alehander92
well yeah
i mean it catches a lot of stuff the biggest problem is it is very slow for some huge case situations
From IRC (bridge bot)
@FromIRC
<Zevv> like, the compiler
<Zevv> :⁠)
Alexander Ivanov
@alehander92
exactly :D
but .. this can be fixed, but my other version
had other bugs and couldn't pass the test suite