<< 25-02-2016 >>

00:01:39*yglukhov quit (Ping timeout: 248 seconds)
00:01:54*reactormonk quit (Quit: WeeChat 1.4)
00:02:09*vendethiel joined #nim
00:09:49*Matthias247 quit (Read error: Connection reset by peer)
00:09:59*jaco60 quit (Ping timeout: 240 seconds)
00:11:02*zepolen quit (Remote host closed the connection)
00:12:36*toaoMgeorge quit (Ping timeout: 276 seconds)
00:22:09*darkf joined #nim
00:23:01*vendethiel quit (Ping timeout: 244 seconds)
00:24:46*awsteele quit (Quit: My Mac has gone to sleep. ZZZzzz…)
00:33:56*miko__ quit (Ping timeout: 250 seconds)
00:36:55ldleworkproc calculateRegionPosition(index, atlas_width: int): tuple[x, y: int] =
00:36:56ldlework (index %% atlas_width, index /% atlas_width)
00:37:19ldleworkIt seems when atlas_width is 0 I can't "expect" with the unit-test any exception type
00:40:59*darkf quit (Ping timeout: 240 seconds)
00:41:33*darkf joined #nim
00:46:26*darkf_ joined #nim
00:46:30*darkf quit (Ping timeout: 250 seconds)
00:46:38*Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif)
00:47:21*Kingsquee joined #nim
00:51:29*darkf_ quit (Ping timeout: 240 seconds)
00:53:23*darkf joined #nim
00:58:49*yglukhov joined #nim
01:01:40*darkf quit (Ping timeout: 250 seconds)
01:02:59*yglukhov quit (Ping timeout: 248 seconds)
01:03:36*darkf joined #nim
01:03:41*darkf quit (Changing host)
01:03:42*darkf joined #nim
01:06:41*darkf left #nim (#nim)
01:11:37*zepolen joined #nim
01:16:24*zepolen quit (Ping timeout: 250 seconds)
01:16:40*vendethiel joined #nim
01:20:32*OnwardEuler joined #nim
01:22:53*gokr quit (Quit: Leaving.)
01:27:56*Dre3ml0rd_ joined #nim
01:32:08*pregressive quit (Remote host closed the connection)
01:32:15*Jesin quit (Ping timeout: 244 seconds)
01:35:50*Dre3ml0rd_ quit (Remote host closed the connection)
01:38:40*Jesin joined #nim
01:39:42*vendethiel quit (Ping timeout: 276 seconds)
01:51:38*Dre3ml0rd_ joined #nim
02:01:44*pengowen joined #nim
02:04:59*cryptotoad joined #nim
02:05:15cryptotoadhey all, was wondering if Nim has a sendKeys like function?
02:08:29*Dre3ml0rd_ quit (Remote host closed the connection)
02:08:38*pengowen quit (Ping timeout: 252 seconds)
02:09:27Araqcryptotoad: what's that?
02:10:39cryptotoadlike to press keys
02:10:43cryptotoadsimulated typing
02:11:00cryptotoadfor automation
02:13:09*zepolen joined #nim
02:13:16*Dre3ml0rd_ joined #nim
02:15:53*pregressive joined #nim
02:16:44*pengowen joined #nim
02:17:29*zepolen quit (Ping timeout: 240 seconds)
02:19:31pengowenhi
02:20:12*Dre3ml0rd_ quit (Quit: Mutter: www.mutterirc.com)
02:21:37pengowenI am trying to install the compiler on windows 7, but I get a gcc error if I try to compile a program.
02:26:14*cryptotoad quit (Ping timeout: 252 seconds)
02:33:42*pregressive quit (Remote host closed the connection)
02:33:53*vendethiel joined #nim
02:38:02*pengowen quit (Quit: Page closed)
02:39:20*pregressive joined #nim
02:48:49*brson quit (Quit: leaving)
02:56:13*vendethiel quit (Ping timeout: 255 seconds)
03:00:12*yglukhov joined #nim
03:00:42*Demos joined #nim
03:04:35*yglukhov quit (Ping timeout: 248 seconds)
03:30:00*lokien_ quit (Quit: Connection closed for inactivity)
04:05:53*pregressive quit (Remote host closed the connection)
04:13:25*endragor joined #nim
04:13:25*endragor quit (Remote host closed the connection)
04:13:55*endragor joined #nim
04:14:42*zepolen joined #nim
04:14:47*gmpreussner quit (Quit: kthxbye)
04:17:02*gmpreussner joined #nim
04:18:59*zepolen quit (Ping timeout: 240 seconds)
04:19:59*pleiosaur quit (Ping timeout: 240 seconds)
04:19:59*SirCmpwn quit (Ping timeout: 240 seconds)
04:21:35*pleiosaur joined #nim
04:21:35*SirCmpwn joined #nim
04:22:59*Kingsquee quit (Ping timeout: 248 seconds)
04:26:12*brson joined #nim
04:26:40*pregressive joined #nim
04:43:54*lxdong joined #nim
04:50:20*lxdong quit (Ping timeout: 252 seconds)
04:52:38*lompik quit (Ping timeout: 250 seconds)
04:57:34*Demos quit (Ping timeout: 240 seconds)
04:58:11*Demos joined #nim
05:01:31*yglukhov joined #nim
05:03:34*Demos quit (Ping timeout: 240 seconds)
05:06:11*yglukhov quit (Ping timeout: 248 seconds)
05:08:22*Demos joined #nim
05:28:22*endragor quit (Ping timeout: 244 seconds)
05:51:06*endragor joined #nim
05:53:18*pregressive quit (Remote host closed the connection)
05:59:37*brson quit (Quit: leaving)
06:11:24*jaco60 joined #nim
06:16:11*zepolen joined #nim
06:18:36*lxdong joined #nim
06:20:29*zepolen quit (Ping timeout: 240 seconds)
06:22:08*Demos quit (Ping timeout: 244 seconds)
06:22:49*vendethiel joined #nim
06:30:28*yglukhov joined #nim
06:34:43*yglukhov quit (Ping timeout: 248 seconds)
06:41:38*dmitry_p joined #nim
06:45:44*endragor quit (Remote host closed the connection)
06:46:27*vendethiel quit (Ping timeout: 248 seconds)
06:48:54*vendethiel joined #nim
06:59:48*endragor joined #nim
07:03:22*endragor quit (Remote host closed the connection)
07:10:50*jamesp joined #nim
07:11:02jamesphi is there someone who could help me answer a question?
07:11:22jamespmy code is as follows:
07:11:26jamesp 11 import json as json
07:11:35jamesp 3 let 2 small_json = """{"test": 1.3, "key2": true}""" 1 jobj = json.parseJson(small_json) 0 jobj2 = parseJson(small_json)
07:11:42*vendethiel quit (Ping timeout: 244 seconds)
07:12:05jamespwhy does parseJson(small_json) work when I only imported json as json
07:12:18jamespI thought it only let using the dot way work
07:12:48*endragor joined #nim
07:21:51*Matthias247 joined #nim
07:28:32lxdongdid you ask a question about performanc & GC yesterday?
07:30:08lxdongyou left before someone could answer you.
07:34:40lxdongI swear to God if I could be sold...then I would be sold.
07:36:24*jamesp quit (Quit: Page closed)
07:36:43*jamesp joined #nim
07:36:47jamespsorry i got logged out
07:37:15jamespyeah so my question was why when i write import json as js i still get exposed to all the functions in json
07:37:32jamespdespite the docs saying i should have to call js.METHOD to call said METHOD
07:41:50*Matthias247 quit (Read error: Connection reset by peer)
07:45:26lxdongyou must get up early
07:48:45*Kingsquee joined #nim
07:50:36lxdongproc parseJson*(buffer: string): JsonNode can be called like buffer.parseJson() or parseJson(buffer) but not js.parseJson(),you should read docs carefully.
07:51:13*yglukhov joined #nim
08:08:30*vendethiel joined #nim
08:09:41*jamesp quit (Quit: Page closed)
08:10:05*OnwardEuler quit (Ping timeout: 244 seconds)
08:10:21*jamesp joined #nim
08:10:35jamesp"A module alias can be introduced via the as keyword:"
08:10:47jamesp"The original module name is then not accessible. "
08:16:13*gokr joined #nim
08:17:43*zepolen joined #nim
08:21:59*zepolen quit (Ping timeout: 240 seconds)
08:24:35*allan0 quit (Ping timeout: 248 seconds)
08:31:07*miko__ joined #nim
08:31:16*vendethiel quit (Ping timeout: 244 seconds)
08:32:32*endragor quit (Remote host closed the connection)
08:37:05lxdong@gokr @jamesp who asked about GC trigger and performance is here ,you can answer him
08:37:33gokrEhm, trying to remember the question...
08:37:54*endragor joined #nim
08:38:15*gokr1 joined #nim
08:38:27*endragor quit (Remote host closed the connection)
08:38:30gokr1jamesp: What was the question? :)
08:38:46gokr1Ah, if one could disable the GC, right? And control it.
08:39:07*endragor joined #nim
08:39:44gokr1Yes, you can disable it alltogether - but that will also render a very large part of all standard libraries "useless", since they rely on it. However, as Araq often mentions, Nim would then still be a very good alternative to C.
08:39:47jamespthe question is
08:39:57jamespno not garbage
08:39:59gokr1But you can also control the GC in quite a lot of detail.
08:40:05gokr1ok, shoot
08:40:08*jaco60 quit (Ping timeout: 250 seconds)
08:40:11jamespin my code i have
08:40:19jamespimport json as js
08:40:20jamespthen
08:40:36jamesplet
08:40:41jamespsmall_json = """{"test": 1.3, "key2": true}"""
08:40:48jamespjobj = parseJson(small_json)
08:40:59jamespwhy am i allowed to write this and not only allowed to write
08:41:07jamespjobj = js.parseJson(small_json)
08:41:49*gokr quit (Ping timeout: 252 seconds)
08:42:32jamespin the documentation for imports it says
08:42:38jamesp"A module alias can be introduced via the as keyword:"
08:42:43jamesp"The original module name is then not accessible. "
08:43:16gokr1Right, but the imported names are accessible still.
08:43:41jamespso in c++ speak, the root "namespace" is being polluted
08:43:46jamespwhy is that?
08:43:46*Arrrr joined #nim
08:44:22jamesplike someone can just call a bunch of functions and as a reader i have no idea which package they came from
08:44:46jamespthat's why in say python i have to write json.parseJson
08:46:21gokr1"It's also possible to use from module import nil if one wants to import the module but wants to enforce fully qualified access to every symbol in module."
08:46:51jamespSo I write from json import parseJson?
08:48:09gokr1Eh, no, "from json import nil".
08:48:14gokr1Btw, related: http://forum.nim-lang.org/t/1914
08:48:30jamespoh literally write nil
08:48:35gokr1Forum has probably several threads worth looking at in this regard.
08:49:09*Trustable joined #nim
08:49:15jamespah cool
08:49:20jamespand i get this error when i do that
08:49:21gokr1I do know the module system in Nim is "debated" by a lot of users. Personally I can't say I have faced any real issues with it though, but... I have only written a few thousand lines of Nim so far.
08:49:28jamespecho $jobj["test"].fnum
08:49:39jamesp"undeclared field: 'fnum'"
08:54:17jamesphow can i access the field fnum when importing as nil
08:54:26jamespor from nil
08:56:29*allan0 joined #nim
08:56:37*toaoMgeorge joined #nim
08:56:55BlaXpiritjamesp, congrats on discovering one of the silliest parts of nim
08:57:18BlaXpirityou can write json.fnum(jobj["test"])
08:57:32jamespoh god
08:57:38jamespthis is disgusting...
08:57:38BlaXpiriti know right
08:57:55BlaXpiritjamesp, you have only these 2 disgusting options
08:58:31BlaXpirit(the other one is having everything global)
08:58:39jamespi get an error with that too
08:58:49jamespecho json.fnum($jobj["test"])
08:58:55jamespoh i need no $?
08:59:21jamespundeclared identifier fnum
08:59:24jamespis still there
08:59:44gokr1It shouldn't be $ inside there. And you don't need it outside either, echo will do it on its own IIRC.
08:59:57BlaXpiritjamesp, I'm sorry, what I said is incorrect
09:00:04BlaXpiritfnum is an ordinary field
09:00:13*vendethiel joined #nim
09:00:25jamespso how do you do this correctly?
09:00:36BlaXpiritmaybe jobj["test"].fnum
09:00:53jamespthat's what i have
09:01:00jamespndeclared field: 'fnum'
09:01:03jamespundeclared*
09:01:12jamespfrom json import nil
09:01:21jamesplet
09:01:27jamesp small_json = """{"test": 1.3, "key2": true}"""
09:01:32jamesp jobj = json.parseJson(small_json)
09:01:37jamespecho $jobj["test"].fnu
09:02:01jamespfnum*
09:02:58BlaXpiritjamesp, correct code: echo json.`[]`(jobj, "test").fnum
09:03:19BlaXpirit(or just, you know, import json normally)
09:04:03jamespah that works now
09:04:07jamespwhat are you doing there?
09:04:25jamespare there plans to fix this lol?
09:04:27BlaXpiritcalling the `[]` function of 2 arguments, which is defined in json module
09:04:33jamespoh
09:04:39jamespok
09:04:50BlaXpiritif you write import json, this function is dumped into global namespace
09:04:55jamespso like yeah are there plans to fix this ;). this is literally my first nim program. seems pretty obvious this is stupid
09:04:58BlaXpiritso you can write jobj["test"]
09:07:25jamespLike what's wrong with pythonic imports? No need to re-invent the wheel here
09:08:17ArrrrWhat's the problem my friend?
09:09:44BlaXpiritjamesp, from x import nil does work like in python
09:09:57BlaXpiritthe difference is that in python a class owns its methods
09:10:01BlaXpiritand in nim they're totally separate
09:10:22BlaXpiritjamesp, obj.stuff("arg") is merely syntax sugar for stuff(obj, "arg")
09:10:56jamespoh so that's the problem
09:11:07jamespare there proposals to fix *this*
09:11:19BlaXpiritjamesp, sure, proposals with no results
09:11:31jamespjust curious, why no results there :)
09:11:41*zepolen joined #nim
09:11:51BlaXpiritjamesp, there is a lot of details to argue about and difficult to implement
09:12:17BlaXpiritbut main thing is the language's author thinks it's good
09:12:20jamespyeah it's obviously very difficult to resolve. but seems like a pretty fundamental thing you'd want
09:12:36jamespthinks the proposal is good?
09:12:40*reactormonk joined #nim
09:12:44BlaXpiritjamesp, thinks the current situation is good
09:12:46jamespoh
09:12:49jamespthat's too bad..
09:13:25*coffeepot joined #nim
09:14:00jamesptbh with all these new languages they seem super awesome at first and then as you learn more you learn all these standard things that aren't quite right
09:14:16BlaXpiritsounds about right
09:14:40BlaXpiritnim is super awesome in many aspects
09:15:57jamespBlaXpirit so you said this is one of the "silliest things"
09:16:03jamespwhat else ranks up there for silly things
09:16:07gokr1jamesp: Well, I guess it depends a bit on how you approach it. A lot of us has managed to write thousands of lines of Nim without getting "bitten" by these less wonderful corner cases.
09:16:08jamesplike give me your top 3 :)
09:17:05jamespgokr1 in this particular case writing import json instead of import json as nil works great when you're playing around
09:17:14jamespbut if you want production level code it's not as nice
09:17:23jamespyou want namespace safety when you start to build a big system
09:17:30BlaXpiritit's no just "not nice", it's unacceptable
09:17:33BlaXpiritbut oh well
09:18:02*ephja joined #nim
09:18:08jamespmy guess is not enough big systems have been attempted in nim then?
09:18:43BlaXpiritattempted maybe, but I don't see any impressive applications
09:18:45jamesplike even when you get to say 10,000 lines in one project you'll run into trouble with this import thing
09:18:55BlaXpiriti mean, the forum is pretty big, and Aporia IDE
09:19:00BlaXpiritand the compiler itself, you know
09:19:01ArrrrWhat's the problem again?
09:19:31jamespThe problem is 1) regular functionality goes away when you import you import BLAH as nil
09:19:42jamespand 2) import BLAH as nil should be the default when you import BLAH
09:19:59ArrrrI didnt even know you could import stuff as nil, what does it do?
09:20:11jamespstops the namespace from being polluted
09:20:17jamespstops the default namespace that is
09:20:22gokr1Not "as nil"
09:20:28jamespand puts the functions of the module into the namespace BLAH
09:20:34ArrrrAh, you mean like import myNameSpace as NS ?
09:20:37jamespoh sorry
09:20:38gokr1"From json import nil"
09:20:44jamespfrom BLAH import nil
09:20:46jamespyeah
09:20:47jamespmy bad
09:20:48ArrrrAh, ok.
09:20:55ArrrrLike from strutils import split
09:21:27jamespthat explicitly would put split in the default namespace correct?
09:21:34jamespthat's OK if it's explicit at the top of the file
09:21:55jamespbut you also want to be able to import everything from a module without polluting the default
09:21:56gokr1I am also guessing the intricacies here has to do with C and how libraries are dealt with etc.
09:22:24ArrrrI dont get your "everything without polluting"
09:22:29jamespOh yeah I'm brand new don't get me wrong this could be a really hard problem.. not proposing a specific implementation detail
09:22:31*vendethiel quit (Ping timeout: 252 seconds)
09:22:34jamespso if i write import json
09:22:41jamespi can then use all the functions in json directly
09:22:53coffeepotPerhaps we just need a setting to choose if you want import as nil or normal import as default
09:23:00gokr1jamesp: You might want to search the forum a bit, I am fairly sure there are TONS of threads regarding imports and modules.
09:23:03jamespsuch as parseJson
09:23:22jamespbut I want it to be the case that in order to call parseJson I must write json.parseJson
09:23:41Arrrryou want to force the use of the module you mean?
09:23:44jamespso that i hint at any reader of my code (including my future self) what i'm doing
09:23:47*allan0 quit (Ping timeout: 248 seconds)
09:23:56jamespyeah so in python you can do three things
09:23:58jamespimport BLAH
09:24:01jamespfrom BLAH import foo
09:24:05jamespor from BLAH import *
09:24:24jamesp(also import BLAH as BL but that's just a special case)
09:24:35jamespit's bad python to write from BLAH import *
09:24:40ArrrrAnd i assume form x import * forces you to write blah.bleh ?
09:24:47jamespno
09:24:53jamespexactly the opposite
09:24:55gokr1jamesp: Do note though that ... there are different views on what is best/right.
09:24:57jamespimport BLAH forces
09:25:11ArrrrOk, now i get it.
09:25:13jamespfrom BLAH import * is the regular nim import
09:25:42jamespgokr1 I'm pretty sure you'd be hard pressed to find a large number of python developers who recommend using from BLAH import * everywhere
09:25:53jamespI've actually never seen that used outside of a quick and dirty script
09:25:57gokr1jamesp: I am not talking about Python.
09:26:05jamespIt doesn't matter what the language is
09:26:11jamespthe namespace principle transcends language choice
09:26:28gokr1Well... I wouldn't state that so categorically.
09:26:50jamespIn this case I'm pretty sure you can say this with very high confidence.
09:26:51gokr1Depending on how many languages you have used of course.
09:26:52coffeepoti think personally I'd find it annoying if say, import tables meant I had to write var x: tables.Table every time. It'd be nice if you could choose how you want the default though if you were being strict (as in large projects)
09:26:55Araqjamesp: use 'from foo import nil' to be forced to write 'foo.bar' everywhere
09:27:24gokr1Araq: But he gets into trouble with say `[]` etc
09:27:33jamespi don't want to have to enumerate from foo import nil, nil1, nil2, nil3 and go find everything
09:27:39jamespoh nil
09:27:42jamespyeah gokr1's point
09:28:02coffeepothow would you specifiy []'s module in python
09:28:11Araqso the universal "namespacing rule" doesn't apply to [] ?
09:28:11jamespAraq: the way I import shouldn't affect my code so deeply
09:28:13gokr1jamesp: I don't want to sound rude, but IMHO there are different models and solutions around modules/namespaces.
09:28:30jamespOK sure there are different models that work. This one doesn't
09:28:54gokr1jamesp: Stating "general truths" is a dangerous practice.
09:28:57jamespNot Python, C++, java all share this
09:29:10jamespI've never seen a language not do this actually
09:29:21jamespanyway
09:29:22gokr1Well, then you may not have used that many languages.
09:29:32jamespI mean yeah I've only used like 10
09:29:47jamespAnd in terms of percent of code in existence
09:29:53jamespI've used like 80-90%
09:29:57jamespmaybe 70
09:29:59jamespidk exactly
09:30:04jamespbut enough to know the principle here
09:30:19veganskAraq, hi! I patched treads.nim to use _beginthreadex API, but this doesn't resolve crashes on mingw. Checked on mingw-w64 with gcc 4.9.1 and vanilla mingw with gcc 4.9.3
09:30:21jamespanyway don't make this ad hominem
09:30:41gokr1I am not, I just get weary when people claim truths.
09:30:42AraqI've written and seen enough Nim code to know it works, Nim is not Java. And Java doesn't work as you think it does anyway.
09:30:56jamesphuh?
09:31:14gokr1(not making it ad hominem I mean)
09:31:14AraqOtherwise Java code would be full of package.foo() but it doesn't, it's full of obj.foo().
09:31:23jamespsorry the huh was to araq
09:31:33gokr1sure, I know. Just clarifying.
09:31:39jamespand how do you initialize the obj :)
09:31:52gokr1I am a Smalltalker for example, and modules/namespaces etc work quite differently there.
09:32:07AraqStringBuffer s = new StringBuffer();
09:32:16jamespAnd at the top of the file
09:32:26jamespyou write where you got StringBuffer :)
09:32:33jamespso there's a direct link in the code
09:32:36jamespmade explicit for you
09:32:42Araqlol as if somebody would read that
09:32:43coffeepotjamesp but you can do that in nim
09:32:56jamespwith the json module how do I do this?
09:32:56*allan0 joined #nim
09:33:07jamespand in java after i have this object
09:33:11jamespi can reference the field member
09:33:16jamespwhich we just said I can't do here in nim
09:33:18ArrrrIn java ides after x imports write import bla.ble.*;
09:33:24jamespI have to do the `[]`
09:33:47jamespyeah but the point is I know the type of s. It's StringBuffer
09:34:01jamespand so when I call s.BLAH, I know that BLAH is coming from a StringBuffer
09:34:10jamespwhen I import json and then call some function there
09:34:20jamespI don't know which of my imports that function is coming from
09:34:40ArrrrBut that happens the most popular languages, c# and java
09:34:45Araqin Java you use an IDE to navigate. In Nim you can do the same.
09:34:54jamespit's not about the IDE
09:35:03Araqsurely it is.
09:35:15jamespno because I don't need to IDE to see that s was declared as StringBuffer
09:35:15Araqnobody reads Java's import lists for exactly this reason.
09:35:20jamespI don't need to read the imports
09:35:28jamespI know where StringBuffer comes from
09:35:35gokr1eh.
09:35:39jamespStringBuffer is sufficient context for me to know where it's being imported from
09:36:01jamespI know this is java.lang.StringBuffer
09:36:15AraqI know JsonNode is json.JsonNode.
09:36:16gokr1How do you? What about Date?
09:36:29jamespYes but StringBuffer is just one class
09:36:38jamespI don't have to learn that for every member method!
09:36:47ArrrrSo, you dont like defining several types in one module?
09:36:50jamespYou have to learn that about every member method of the json module
09:37:00jamespi'm talking about methods
09:37:21jamesplike the parseJson method
09:37:27coffeepotso, it's okay for StringBuffer, but not for other things?
09:37:30Arrrrif you import x, you dont have to care about that. I dont know what's the issue
09:37:41jamespIt's ok for stringbuffer because stringbuffer is only one name
09:37:53jamespi don't do that for every method in the stringbuffer class
09:38:07coffeepotwhy not?
09:38:14jamespSay somebody writes import json
09:38:20jamespthen later in their code they write
09:38:33jamespjobj = parseJson(small_json)
09:38:57jamespi have to figure out where parseJson came from (in this case it's easy because json is in the name but it's often not)
09:38:59reactormonkDo we still support XP? https://github.com/nim-lang/nimsuggest/issues/20
09:39:15jamespin java i'd write
09:39:21ArrrrBut in python you dont explicit declare types and is not a problem there
09:39:21coffeepotso then you tell people to prefix the module.parseJson?
09:39:22jamespStringBuffer s = new StringBuffer()
09:39:29jamespin python it's easy
09:39:31jamespi write import json
09:39:37jamespthen I MUST write json.parseJson
09:39:37coffeepotthis sounds more like a personal code review situation
09:39:44jamespparseJson isn't in the namespace
09:39:59reactormonkjamesp, from json import parseJson
09:40:19AraqC doesn't even have namespaces and billions of lines of production code are written in it. So much for that "Universal principle" (that isn't followed by *any* language anyway).
09:40:25Arrrri thought the inet_top thing was resolved already
09:40:32jamespC is 21st centure assembly
09:40:38jamespturing machines don't have namespaces either
09:40:48jamesplike come on
09:41:07jamespreactormonk: i don't want to have to explicitly import every function i care about
09:41:17jamespI want to just write import json
09:41:24Araqjamesp: then don't! ;-)
09:41:39jamespi think you're missing the point
09:41:41Araqreactormonk: we surely try to support XP
09:41:55gokr1I am not a Python guy, but how does Python handle things like `[]`?
09:42:01jamesphow do you import all functions from a module into a namespace?
09:42:07AraqI know your point perfectly well, I have heard this argument thousands of times by now.
09:42:22coffeepotimport module as new_namespace isn't it?
09:42:23jamesplike this is a very common thing people want to do
09:42:44jamesphow do i import everything into a namespace and not into the common namespace without changing my code
09:42:45Arrrrreactormonk https://github.com/nim-lang/Nim/pull/3787
09:43:25reactormonkArrrr, cool, thanks
09:43:25jamespfrom json import nil makes you change the code
09:43:40jamespecho json.`[]`(jobj, "test").fnum is not very readable
09:43:57Araqfrom json import `[]`
09:44:11Araqalso you argue that it is readable. ;-)
09:44:20Araqbecause you like full qualifications.
09:44:40Araqand so you don't have to search where [] comes from. etc etc etc
09:44:51jamespThat's now too verbose
09:44:56gokr1(and I don't like full qualifications)
09:45:05jamespThe point is to get the best of both worlds
09:45:08jamespand here you can't
09:45:20coffeepothow is that too verbose, it's one import statement at the top?
09:45:20jamespyou have to choose between the benefits of the qualifications and benefits of not having them
09:45:26jamespi want to have my cake and eat it too
09:45:28Araqthe point is that you're totally arbitrary.
09:45:30jamespas i would in python
09:45:41jamespIn practice this is not arbitrary at all
09:45:50coffeepotjamesp how do you do this in python?
09:45:51jamespThe module has several functions that are related
09:45:54jamespin python
09:45:58jamespI write import json
09:45:59Araqimport json except JsonNode
09:46:00jamespdone
09:46:06ArrrrI recall that i suggested a {.pure.} for when importing modules.
09:46:16Araqvar j: json.JsonNode # woohhoo like in Python
09:46:30Araqj["foo"] = "bar" #wooohoo like in Python.
09:46:40jamespyeah now you have to name what you're importing
09:46:45jamespi shouldn't have to name that in the imports
09:46:57jamespi'm importing the full module because things in the module like to be imported together
09:47:03jamespthat's why they belong in a common module
09:47:15jamespso it makes sense to import the full thing without being explicit about which part
09:47:30Araqnothing of this makes any sense.
09:47:39flyxso what exactly is your problem with „from json import nil“?
09:47:44jamespWhy do C++ and python do it this way then?
09:47:46jamespand java
09:47:49Araqeither you have decent tooling to navigate through large code bases
09:47:53Araqor you don't.
09:47:54jamespfrom json import nil break
09:48:00Arrrrlol, we are making the same question to jamesp.
09:48:01jamespecho $jobj["test"].fnum
09:48:09Araqand language design cannot patch over broken tooling.
09:48:20jamespyou now have to write
09:48:21jamespecho json.`[]`(jobj, "test").fnum
09:48:27jamespapparently
09:48:36gokr1Araq: Did I mention the funky module system I devised in Smalltalk a few years back?
09:49:20flyxwell. Ada has „use type foo“ to import all inline functions of the given type in the standard namespace. I haven't seen this anywhere else though
09:49:38gokr1I was quite pleased with it - but... alas it never got accepted. Too much legacy friction, people are scared of change ;)
09:50:56jamespSo there isn't this huge debate about python namespaces because they figured out the problem and solved it correctly. now they focus on other problems in the language
09:51:33jamespAnyway having things go into the default namespace breaks of a lot of safety concerns
09:51:52gokr1It was based on an idea that people have a knee jerk reaction against, the idea that we almost always "render" source code (highlighting, folding etc), so we could actually dynamically render "full qualifications" as short as possible.
09:51:58Araqyeah sure, for some definition of "safety" that you just pulled out of your ass.
09:52:15jamespNot at all. Say I define a function foo
09:52:19jamespand i mispell calling it
09:52:25jamespi accidently call food
09:52:32jamespbut food has been defined by my import
09:52:37jamespand it suddenly calls food
09:52:40Araqso let's start a buzzword fight: Nim's way actually encourages loose coupling where things can move more freely around.
09:52:57jamespcould you explain what you mean by that?
09:53:03flyxthe difference between Python and Nim is that Nim does type checking, so you usually don't accidentally call a function you don't want to, because the param types do not match
09:53:11ArrrrBtw reset shouldn't be in system, you can have accidents there.
09:53:19jamespi agree python is very unsafe in many ways
09:53:30jamespi'm not arguing python is safe :)
09:53:51jamespor that python is the best language or anything like that
09:54:01jamespi'm saying in the case of modules, python does things very well
09:54:28jamespsorry Araq what does loose couplings mean here?
09:54:36Araqand here is the thing: Nim is not Python, and Python's solution would be a disaster for Nim.
09:54:53jamespCould you explain why? It'd be interesting to hear
09:55:04jamesp(just the namespace part of python not other things)
09:55:12Araqand fyi I use 'from foo import *' everywhere in Python.
09:55:41jamespHaha I can't endorse that
09:56:18jamespSo why would using namespaces in the python way be a disaster in nim?
09:56:18Araqjamesp: I refactor code, when refactoring code I move things around and don't want to patch 'module.foo' into 'moduleB.foo' all the time
09:56:39jamespIn this case you create a tool that does it for you
09:56:57jamespSo like is the refactoring the reason?
09:57:03jamespOr is there something more fundamental
09:57:45jamespLike actually I think the real question I want to ask is
09:58:02jamespWhy when you write "from json import nil"
09:58:13jamespwhy would it be bad to allow this to still work:
09:58:19jamespecho $jobj["test"].fnum
09:58:47coffeepotwell can you do from json import nil AND import `[]` from json?
09:59:13*allan0 quit (Ping timeout: 255 seconds)
09:59:14jamespcould you explain the [] part?
09:59:18jamespI don't think i fully understand it
09:59:28gokr1It's the indexing operator.
09:59:40gokr1It's just a function, like other functions.
09:59:48gokr1But with a funky name.
10:00:29AraqPython only gets away with it because it attaches methods to classes and so importing the class gives you all the methods too. Nim doesn't attach procs to types and so what is a class in Python is usually a *module* in Nim.
10:00:46Araqand that's why we like to import *everything* from the *module*.
10:00:59AraqI don't understand why it is so hard to see that.
10:01:41*Arrrrr joined #nim
10:01:56jamespAraq: if it only the [] part that breaks when you write from json import nil?
10:02:04*Arrrr quit (Ping timeout: 240 seconds)
10:02:14jamespor are there other problems wirht from json import nil?
10:02:16Araqfrom json import `[]`
10:02:23jamespsorry yeah
10:02:39Araqworks too and lets you use [] like you want and requires qualification for the other things
10:03:01jamespWhy is it [] that I have to import to access dot fnum?
10:03:07jamespI don't really understand this part
10:03:13AraqI don't know why 'from json import nil' should mean 'from json import `[]`'
10:03:31gokr1jamesp: It's not for fnum, its for the ob["blabla"] part.
10:03:36jamespno writing both
10:03:42jamespah ok gokr1
10:03:57jamespohhh i see
10:04:20jamespso dictionary lookup is something you have to explicitly import
10:04:23gokr1But as BlaXpirit showed, you can actually call [] using regular function syntax too, so that you can qualify it.
10:04:24jamespit's not there by default
10:04:32jamespyeah i see that
10:04:50jamespso tbh this is more of a question about [] and less about modules right?
10:05:01coffeepotyes sounds like it
10:05:04gokr1Do note that [] is a function like any other function. They are overloaded per types etc. You can define your own.
10:05:05coffeepotor even more specifically
10:05:18coffeepotthis is more a question on how operators are overloaded in nim
10:05:22jamespso in other languages [] is special cased right?
10:05:32jamespthis is making a lot more sense
10:05:38gokr1Well, again, it depends on how many languages you have used :)
10:05:46Araqno, the only question is why 'Python class corresponds roughly to Nim module' is so hard to accept.
10:05:47jamespOK I'm thinking this is less of a problem than I originally thought :)
10:06:00*allan0 joined #nim
10:06:06coffeepotyou can create your own operators in nim, eg proc `&%`(a: myType) etc
10:06:13jamespI'm just using python as an example, and focusing on the module part, not the class part
10:06:15coffeepot`[]` is just one example
10:06:26endragorAraq: I think you are actually answering a different question. There is a simple misunderstanding of operator overloading from jamesp.
10:07:03jamespendragor: there are two questions here. both a misunderstanding from me and the question araq is answering
10:07:39jamespOK so I suppose in the languages I've experienced
10:07:50jamespWhen you do the equivalent of from json import nil
10:08:00jamespfunctions like [] are put into the default namespace
10:08:17jamespand more standard functions such as parseJson are put into the json namespace
10:08:38jamespIn that sense [] is special cased elsewhere...
10:08:43endragorno, in case with python, it's __getitem__ function that is tied to the type. so when you import the type, the function is imported
10:09:02endragorin Nim procedures are not tied to types
10:09:24jamespendragor: in python [] is part of dictionaries which are imported everywhere no need for a statement
10:09:27jamespright?
10:09:28coffeepotthat's because you're importing a type in python, where [] is part of the type. In nim, it's all procs that take particular types as params, so you have to import the [] as well
10:10:17jamespno in python you'd use a dictionary not a json "type"
10:10:18endragorjamesp: no, [] can be overloaded in Python, too
10:10:23jamespoh ok i see what you're saying
10:10:34jamespso if [] is overloaded by the type in question
10:10:40jamespyou still don't have to write import []?
10:10:44jamespthat's the point
10:10:46endragoryes, because it's in the type
10:11:00jamespsometimes we're talking about a dictionary and it's a moot point
10:11:05jamespbut when we're not ah
10:11:22jamespOK I withdraw most of my criticism :)
10:11:30coffeepotdicts are in the default namespace in python iirc, whereas in nim you have to import tables to use dict
10:11:33jamespWith the caveat that I think import json as nil should be the default
10:11:40jamespfrom json import nil
10:11:41jamespsorry
10:11:57Araqjamesp: yeah, beginners tend to think that. ;-)
10:12:07coffeepotand in tables sure enough there is a proc `[]`[A, B](a: A, b: B)
10:12:07jamesphaha fair
10:12:16*allan0 quit (Ping timeout: 255 seconds)
10:12:17jamespAraq why do you think beginners believe that?
10:12:51jamespSo I guess my claim is based on safety and code navigation
10:13:00Araqbecause you're really not special. ;-)
10:13:09jamespI can understand the safety claim is a weak one because the static typing gives you enough safety
10:13:37Araqpeople come from Python where "omg, he is a nazi because he used 'from foo import *'" is universally accepted
10:13:39jamespAraq: sorry not asking if i'm special. why do beginners tend to get this wrong?
10:13:51jamespYes i understand that
10:13:54jamespbut specifically
10:13:58jamespWhy is it OK to do this?
10:13:58Araqand then they notice it's the DEFAULT in Nim
10:14:07Araqthat can't be right!!!
10:14:17jamespYeah so why do you think that it's good for reference
10:14:27Araqin other words: Everybody argues exactly like you do.
10:14:29jamespLike your argument is an argument that should apply to python too?
10:14:31jamespright
10:14:42coffeepotjamesp, beginners almost by definition are used to what they've experienced and not what they haven't
10:14:53jamespNo this is a different point coffeepot
10:15:05jamespLike Araq is saying that in python from BLAH import * is good too
10:15:23jamesp(and he literally said this earlier so he's being self-consistent)
10:15:45jamespSo like I guess my question is why do you think from BLAH import * is good in python? Common knowledge is that it's bad
10:15:50Araqwell I often like procedural style over OO
10:16:13jamespWhy is procedural vs OO related here?
10:16:15Araqso my Python style is more like 'free floating defs everywhere'
10:16:25Araqnot attached to a class
10:16:29jamespLike you could have procedural with namespaces though
10:16:37Araqand then Python's import foo is annoying
10:16:45AraqI use 'from foo import *'
10:16:51jamespSo let's say we're 100% in procedural land
10:16:56Araqand I can move defs around then.
10:16:58endragorjamesp: "non-safety" point is more minor for Nim, because it has static typing. It's waaay easier to make a mistake in Python by calling what you not intended to call. In Nim you will get an error in the same case. Writing "JsonNode" instead of "json.JsonNode" helps brevity and readability of the code.
10:17:06*Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif)
10:17:09jamespyeah i agree the non-safety point is minor
10:17:15jamespendragor: i think that's exactly right
10:17:25Araqjamesp: and coming back to the refactoring argument.
10:17:30jamespbut my point is that json.JsonNode is more readable even when you throw out the safety argument
10:17:40jamespSo like you could make a tool that does this for you
10:17:56jamespLike intellij does this in java land
10:18:00Araqthere is a difference between 'goto definition' and *modify* this piece of code for me.
10:18:04jamespSo I can't really believe that'd the reason
10:18:16jamespthat'd be*
10:18:26Araqthe modifications end up in the git history, for example.
10:18:41Araqplus it's harder to write a tool that does it reliably.
10:18:49jamespoh ok
10:18:54Araqof course I like to have these tools.
10:18:55jamespthat's fair
10:19:06jamespthe git history thing is something the tool doesn't solve
10:19:20Araqbut nevertheless code modifications are more disruptive than simply helping me to navigate.
10:19:39jamespOK this looks like less of a problem than I thought
10:19:44jamespOK quick unrelated question
10:19:56jamespWhat kinds of performance benchmarks does nim get for super low latency stuff
10:20:03jamespLike when you care about nanseconds
10:20:23*allan0 joined #nim
10:20:41jamespSo say I'm writing a program that allocates memory on initialization. And then while it's running during the day never again allocated memory
10:21:01jamespAnd I want to get down to the hundreds of nanos per "event processed"
10:21:12jamespWill nim be competitive with C here?
10:21:25Araqyeah, highly competitive
10:21:37jamespAnd how would I in nim have it never call the GC?
10:21:49jamespI want to totally turn off the GC and yell at me if I try to allocate too much memory
10:21:52Araqand you don't even have to watch out for allocations all that much since the GC adheres to the deadlines you give it
10:22:05Araq*you give to it
10:22:16*toaoMgeorge quit (Read error: Connection reset by peer)
10:22:21jamespSo is it always crystal clear when I'm allocating memory?
10:22:26jamesplike in C it's SUPER clear
10:22:40jamespI want to be able to write a large amount of code that I know for sure doesn't allocate anything new to the heap
10:22:49Araqyeah right because you don't use function calls in C ;-)
10:23:02jamespOK it's not literally 0
10:23:07jamespbut like that gets collected for me
10:23:12jamespLike it's really low :)
10:23:23Araqin Nim the allocations are hidden pretty much the same way they are in C, IMHO.
10:23:36jamespah ok
10:23:45jamesphaha for context the problem i just described is that of hft
10:23:46Araqexcept that you will argue that they are hard to spot
10:24:00jamespyou're saying they're not hard to spot?
10:24:01Araqbecause you don't know Nim as well as you C
10:24:05jamespoh sure
10:24:07jamespfair
10:24:30jamespin regular imperative land are function calls the only thing that go on the heap?
10:24:56reactormonkjamesp, in imperative land you have no guarantee whatsoever what the function you call does.
10:25:15jamespreactormonk: what exactly do you mean?
10:25:21Araqjamesp: --gc:none tells you where you used allocations
10:25:26dom96Hello jamesp. I tried my best to read most of the IRC logs, and all I can really do now is reassure you that the Nim way works well. You have nothing to worry about when using the default 'import json' syntax.
10:25:58jamesphaha point taken
10:26:33dom96I guess these guys have done a lot to convince you already. But let me convince you more: I've written Aporia, Nimble, NimForum, Jester and a lot of other Nim projects. Have I ever written `from json import nil`? No.
10:26:51Araqdom96: we have moved on.
10:27:05jamespAraq: --gc:none means that you just get allerted or that the gc does nothing altogether?
10:27:25dom96Araq: Good :)
10:27:35Araqjamesp: it disables the GC at runtime which is not that useful.
10:27:54Araqhowever, it also makes the compiler complain where you depend on the GC
10:27:55jamesp"not that useful" depends on your application :)
10:28:10jamespso it still does gc for function calls though
10:28:11jamesp?
10:28:14Araqso there is a compiletime checking aspect to it that's more useful
10:28:42jamespcause you said function calls go on the heap
10:28:52Araqno no no.
10:29:06AraqI said in C allocations can be hidden in functions.
10:29:20Araqand they can in Nim too.
10:29:29jamespSo when you mark --gc:none
10:29:36jamespWhat happens when you repeatedly call a function?
10:30:23Araqit gets a fresh stack frame repeatedly, same as in C
10:30:41jamespSo it won't run out of memory?
10:30:49jamespon IN functions
10:30:53jamespnot by calling the function
10:31:06Araqmy point was that in C it's not "super obvious" where the allocations are.
10:31:11jamespoh ok
10:31:25Araqas C code consists mostly of function calls and functions can internally use 'malloc'
10:31:41jamespand that malloc is automatically freed for you?
10:31:51jamespSo what happens in nim when you have function calls and --gc:none
10:31:56jamespdoes that get freed for you?
10:32:14Araqyes, if the function doesn't use the GC.
10:32:23jamespah
10:32:27jamespsoooo in conclusion
10:32:33jamespnim is very suited for high frequency trading
10:32:43jamespthat's my takeaway from the gc discussion
10:32:55Araqgood, but it's more complex than that.
10:33:10jamesphaha of course
10:33:15jamespwhat do you mean by more complex than that?
10:33:35Araq1. the stdlib uses the GC. it's counterproductive to avoid the stdlib but not worse than C where you barely have a stdlib.
10:33:51jamespthe nim stdlib uses gc?
10:34:00jamespah
10:34:05Araqand the other libraries you can get for the C, you can use from Nim too ... soo no loss.
10:34:30*gmpreussner quit (Read error: Connection reset by peer)
10:34:40jamespbut using objects doesn't invoke the gc?
10:34:43Araq2. the GC is a realtime GC, adhering to the deadlines you give to it.
10:34:45*zepolen quit (Remote host closed the connection)
10:34:47jamesplike general nim syntactic sugar
10:35:06jamespSo in the C code I write, I don't use the gc
10:35:09*zepolen joined #nim
10:35:10jamespit would be too slow
10:35:28jamespother than these function calls
10:36:05Araq3. since the GC is per thread there are plans to have "GC free" threads which replace the GC with region based memory management under the hood.
10:36:20*gmpreussner joined #nim
10:36:29jamespah ok
10:36:32jamespvery nice
10:36:44Araqnote that for 3. you can use all of Nim's stdlib.
10:37:00jamespWhat are the costs of 3?
10:37:13*toaoMgeorge joined #nim
10:37:28Araqharder to ensure memory consumption stays reasonable.
10:37:31jamespok
10:37:40jamespSo in the C code that we write
10:37:50jamespWe do little tricks like make sure the structs are cache aligned
10:37:55gokr1Araq: This "function calls go on the heap"... the Nim stack is the C stack, or is there something I am missing? There is no heap involved in that, right?
10:38:15jamespcan you do these in nim?
10:39:32Araqjamesp: yes and 'object' maps to struct, it's not allocated on the heap.
10:39:42jamespok
10:40:17Araqgokr1: right.
10:40:21jamespdo you have a guess for how long it'll take to have a 1.0 that's accurate to within a factor of 2? :)
10:41:43gokr1jamesp: On the other hand you often use "ref object" (not just "object") and then its allocated on the heap. Up to you, what you need.
10:41:52jamespyeah
10:41:57jamespmhm
10:42:11gokr1I wrote a whole series of articles about OO in Nim, on my blog.
10:42:39*lokien_ joined #nim
10:43:48jamespgokr is this your blog http://goran.krampe.se/
10:44:00gokr1Yeah, check http://goran.krampe.se/category/nim
10:44:02jamesplol i read those today :)
10:44:06gokr1Oh :)
10:44:35coffeepotjamesp don't forget you can always look at the generated C code with nim to understand what it's doing
10:45:49jamespAraq said nim is competitive with C in speed. What makes it competitive? Being compiled to C isn't enough. OCaml for example is not competitive and it compiles to C
10:46:52Araqjamesp: I try to make no claims about when v1.0 will be ready. but I can assure you that we already have a good "how hard is it to upgrade old code" story.
10:47:21jamespoh you're saying once you get to 1.0 it's hard to make improvements?
10:47:40jamesphaha Araq not asking for any guarantees! just curious if it's like 1 year or 2 years or 5 years or 10 years
10:48:38jamespAlso you should get nim onto the language benchmarks game!
10:50:15Araqjamesp: we have lots of benchmarks where Nim is on par with C
10:50:28jamespYeah I just mean to get attention
10:50:42jamespPeople pay attention to that website
10:50:44*lxdong quit (Quit: Page closed)
10:50:56Araqand no Ocaml doesn't generate C code
10:51:19jamespisn't it interpreted by a C compiler?
10:51:49AraqOcaml has its own native code backend
10:52:05jamespSo why do people say it goes through C?
10:52:05Araqas well as an interpreter for quick development.
10:52:32jamespMy PL prof from college said it went through C in some way
10:53:01jamespmaybe i'm mis-remembering
10:54:03Araqyou're right though, generating C code is not enough. the language needs to map closely to C to get the same perf benefits. And Nim does that.
10:54:31jamespAh
10:54:41jamespI should start reading the compiler in my spare time
10:54:49jamespwould probably be a good learning experience!
10:57:02jamespThis has been fun. Thank you for all of the wisdom
10:58:03*exebook quit (Ping timeout: 276 seconds)
11:04:10*exebook joined #nim
11:04:59*vendethiel joined #nim
11:05:42*jamesp quit (Quit: Page closed)
11:10:21*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
11:10:40*coffeepot joined #nim
11:12:10*arnetheduck quit (Read error: Connection reset by peer)
11:12:38*coffeepots joined #nim
11:13:03*arnetheduck joined #nim
11:13:04*coffeepot quit (Client Quit)
11:14:17*coffeepots is now known as coffeepot
11:15:42*allan0 quit (Quit: no)
11:15:58*allan0 joined #nim
11:38:13*toaoMgeorge quit (Ping timeout: 255 seconds)
11:47:40*vendethiel quit (Ping timeout: 255 seconds)
11:47:48*PMunch joined #nim
11:49:25gokr1Super silly idiotic question. I have an int. How do I convert it to uint32?
11:50:18Araquint32(x)
11:50:35gokr1I thought so too, but... not sure what is happening.
11:51:00gokr1Don't have any reasonable way to debug, not even printfs. :)
11:54:04gokr1When c2nimming I mangled uint32_t to uint32, was that correct?
11:54:18Araqsure
11:54:30gokr1Ok, so... (hang on)
11:58:39*vendethiel joined #nim
12:02:16gokr1Araq: http://pastebin.com/g4mEZA8B
12:02:36gokr1The first two don't work. It seems to be blinking "very fast".
12:02:45gokr1The last one with hardcoded 1000 works.
12:02:58gokr1Also threw in the proc declaration from the wrapper there.
12:04:18gokr1Oh, the setup and loop are templates...
12:05:17gokr1They just expand to proc loop*() {.exportc.} =
12:08:38Araqgokr1: looks like globals are not initialized properly on your system
12:08:50Araqmaybe it ends up being 0
12:09:08Araqand gets assigned the 1000 after the 'loop' for reasons that escape me
12:09:42Araqwrite the assignment in the 'setup' section perhaps
12:10:59*dmitry_p quit (Ping timeout: 240 seconds)
12:12:24*thotypous quit (Ping timeout: 244 seconds)
12:13:05gokr1You seem to be right, moving the var into loop... made things start working... hmm.
12:18:17veganskAraq, please see my latest comments on https://github.com/nim-lang/Nim/issues/3889. The problem of my library is that I can't use ``--tlsEmulation:on`` because of the foreign threads from the main c++ application.
12:18:20gokr1ok, so ... yeah, initializing on module level doesn't seem to work.
12:19:29Araqvegansk: how is that an issue?
12:20:33*vendethiel quit (Ping timeout: 240 seconds)
12:21:15veganskAraq, it's about createThread crashes
12:24:21*toaoMgeorge joined #nim
12:25:37Araqvegansk: no I mean why you cannot use --tlsEmulation:on
12:27:43veganskWhen the foreign thread is created, it doesn't initialize structures for the TLS emulation, i.e. there is no ``GcThread`` object
12:29:59veganskThere was a PR https://github.com/nim-lang/Nim/pull/3786, with the same problem - crashes in ``setupForeignThreadGc`` because of thread vars
12:35:55wuehlmaus hmm, i have a very strange problem with tnim and i run out of ideas now
12:36:09*toaoMgeorge quit (Quit: Bye)
12:36:14wuehlmauswhen i try to echo something it doesn't output anything
12:36:33wuehlmausi deleted tnim.dat and i even reinstalled tnim no no resolution
12:37:01wuehlmausdoes anyone have an idea what i could do?
12:37:23wuehlmausnim secret DOES echo but it's a little too unstable to use
12:38:13wuehlmausand i deleted the nimcache, too
12:40:43veganskAraq, sorry, really must go now :-( I will think about it tomorrow
12:41:04*lxdong joined #nim
12:46:27def-wuehlmaus: I would just not use tnim, it's probably not well tested
12:46:27*vendethiel joined #nim
12:50:30wuehlmauswell what can one do if he loves using a REPL....
12:50:53wuehlmausnormally it helps me to understand stuff better
12:51:58wuehlmausit worked fine for weeks , too
12:55:14gokr1Ni managed to run "1000" (kinda silly program) on my Linkit ONE :)
13:00:00*lokien_ quit (Quit: Connection closed for inactivity)
13:00:15*toaoMgeorge joined #nim
13:06:02Araqwuehlmaus: no idea. are you using Nim devel? maybe that has some recent regression
13:07:12*vendethiel quit (Ping timeout: 244 seconds)
13:10:13wuehlmausyes, i use the git version
13:11:12wuehlmausbut as i use archlinux i was able to install the arch version and still the problem was not gone so i am REALLY confused now
13:11:34wuehlmausarch is quite current and has 0.13
13:12:37bbl_"The current implementation of message passing is slow and does not work with cyclic data structures." What is the current state/status of channels?
13:12:45Araqwuehlmaus: try 0.13 instead of devel please
13:13:10Araqbbl_: 'slow' is relative and mostly refers to it not using lockfree stuff
13:13:50Araqcycles still don't work. ;-)
13:14:12bbl_Araq: nice :P
13:15:02bbl_Araq: will I be able to use parseql at compiletime?
13:15:46Araqwill you? yes. does it work right now? with a chance of 30% perhaps
13:16:00bbl_Araq: that's what I was thinking
13:16:12Araqbut you can always use staticExec right now as a decent workaround
13:16:20AraqstaticExec supports caching too.
13:16:40bbl_I started writing yessql/hugsql like lib for nim and it would be really cool to leverage parsesql with it
13:17:02Araqmy lexim project works 100% at compile-time
13:17:12bbl_nice :P
13:17:17Araqand yet I changed it to use staticExec
13:17:24bbl_hmmh?
13:17:28Araqcompile-times went from minutes to seconds
13:17:46Araqit does DFA minimization for lexer generation
13:19:00bbl_I'm wondering what you are calling with staticExec
13:19:16AraqI planned to give a talk about it. ...
13:19:31bbl_I just love the fact that I don't need any outer tools writing compile time features
13:19:37Araqwas a 10 line patch
13:19:43bbl_:P
13:19:49Araqsince compiletime Nim is the same as runtime Nim :-)
13:19:59bbl_<3
13:20:31Araqcheckout out lexim, I'm sure you'll understand
13:20:43bbl_Araq: checking indeed
13:21:09Araqnim supports marshal.nim at compile-time
13:23:06*endragor_ joined #nim
13:26:54*endragor quit (Ping timeout: 276 seconds)
13:27:34*endragor_ quit (Ping timeout: 255 seconds)
13:47:07bbl_Araq: I'm looking forward to that talk
13:51:31bbl_Araq: I was wondering about tuples again the other day, tuples can be unpacked var (x, y) = someProc(), why wouldn't those unpack implicitly to proc args: proc myProc(x, y: int) = ... , myProc((1, 2))?
13:51:56bbl_this would enable chaining with multiple return values
13:52:42Araqtoo ambiguous
13:52:57Araqyou can write an unpack macro to do that though
13:53:49bbl_Araq: I'm just thinking that would be awesome when combined with currying :P
13:54:17bbl_can't see any pitfalls :D
13:55:03Arrrrr+2
13:59:17*lompik joined #nim
14:02:11wuehlmausouch, it seems that tcc is the problem
14:02:43wuehlmauswhen i use clang as cc i have a working echo.
14:02:56arnetheduckhey, any reason why there's an caseexpr in the compiler? like ifstmt/ifexpr?
14:03:05arnetheduck*no caseexpr
14:20:48*OnwardEuler joined #nim
14:23:24*zepolen quit (Remote host closed the connection)
14:33:54*zepolen joined #nim
14:46:58*lxdong quit (Quit: Page closed)
15:05:07Araqarnetheduck: I figured it's not required. ifexpr isn't required either, but was introduced before I figured it out.
15:06:58wuehlmaustnim without tcc is not much fun, tcc makes it very bearable but with clang you FEEL the compilation happening :) won't try with gcc
15:07:23*gokr1 quit (Quit: Leaving.)
15:07:28wuehlmausanyway --cc=clang solved it
15:08:05*vendethiel joined #nim
15:09:38arnetheduckah. caught me off guard.. by that logic, none of the expr/stmt division is really needed? though it was pretty convenient for nlvm at least
15:10:27arnetheduckAraq, so it's also not a bug that ifstmt is sometimes used when if is an expression?
15:11:18Araqyes. the division is really void type vs non-void type
15:13:47arnetheduck769/1074 tests passing with nlvm btw.. getting into the hairier parts ;)
15:26:06*mat4 joined #nim
15:26:07mat4hello
15:26:26*Wildefyrr joined #nim
15:26:42*allan0_ joined #nim
15:26:59*allan0 quit (Ping timeout: 240 seconds)
15:26:59*Wildefyr quit (Ping timeout: 240 seconds)
15:30:34def-arnetheduck: very cool. would an LLVM JIT REPL and compile time execution be possible? Basically replacing the Nim VM with LLVM JIT.
15:31:47*vendethiel quit (Ping timeout: 248 seconds)
15:33:00arnetheduckdef-, shouldn't be too much trouble
15:33:29def-arnetheduck: well, that would be great: more performance at compile time and a functional REPL
15:34:52arnetheduckdef-, have more pressing issues than performance, for now ;)
15:37:49arnetheduckdef-, they even have a command line jit, though I haven
15:37:53arnetheduckt tried it
15:44:51*jaco60 joined #nim
15:45:44mat4a LLVM backend for Nim ?
15:47:07*pregressive joined #nim
15:47:45flyxhaving one would be pretty cool
15:48:34flyxbut the correct term would be frontend, not backend
15:49:41mat4ok, name it frontend to a code generator, that's fine
15:51:16mat4anyhow, I think there exist already a project for a C interpreter with JIT compiler
15:51:44mat4I just can't remember right now where I found it
15:53:04arnetheduckI've had that naming issue.. from the nim compiler perspective it's a backend, but in llvm, it's clearly a frontent.. middle end maybe?
15:53:55arnetheduckmat4, https://github.com/arnetheduck/nlvm
15:55:47mat4ok, after a quick research, it it the Cling project, an C++ interpreter. I think it can be used with Nim's C++ 'backend' = source generator somehow
15:58:03mat4arnetheduck: For the Nim compiler, LLVM generation would be one backend. However, the generated IL (for intermediate language) is part of the frontend if I'm correct
15:58:47mat4I mean a LLVM IL generator would be a backend for the Nim compiler
16:07:13mat4here is the link: https://solarianprogrammer.com/2012/08/14/cling-cpp-11-interpreter/
16:08:09mat4the interpreter is used mainly at CERN (mature code)
16:08:29*pregressive quit (Read error: Connection reset by peer)
16:08:42*gokr joined #nim
16:09:06*pregressive joined #nim
16:11:36*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:25:46*yglukhov quit (Ping timeout: 255 seconds)
16:31:33bbl_Araq: nimsuggest can't handle using channels?
16:38:12*PMunch quit (Quit: leaving)
16:39:10*toaoMgeorge quit (Read error: Connection reset by peer)
16:40:02*gokr quit (Ping timeout: 244 seconds)
16:45:19*Demos joined #nim
16:46:03*nsf quit (Quit: WeeChat 1.4)
16:48:54*Sembei joined #nim
16:59:06Araqbbl_: more likely: you need to tell nimsuggest about --threads:on
16:59:27bbl_Araq: I feel really stupid now
17:00:46bbl_Araq: I'm also not getting the docstrings so there must be something equally as stupid going on
17:02:29*arnetheduck quit (Ping timeout: 240 seconds)
17:08:54*vendethiel joined #nim
17:13:19*Trustable quit (Remote host closed the connection)
17:16:45*dorei joined #nim
17:17:30*yglukhov joined #nim
17:21:59*yglukhov quit (Ping timeout: 240 seconds)
17:29:40*vendethiel quit (Ping timeout: 244 seconds)
17:43:40*yglukhov joined #nim
17:47:50*zama quit (Quit: leaving)
17:49:24*zama joined #nim
17:52:40*brson joined #nim
17:57:06*vendethiel joined #nim
18:20:01*nsf joined #nim
18:33:49*gokr joined #nim
18:33:50*gokr quit (Read error: Connection reset by peer)
18:34:02*gokr joined #nim
18:42:48*shodan45 joined #nim
18:44:18*gokr left #nim (#nim)
18:56:20*yglukhov quit (Remote host closed the connection)
18:56:41*yglukhov joined #nim
19:05:25*yglukhov quit (Remote host closed the connection)
19:24:23*wh1t3r0s3 joined #nim
19:28:38*jaco60 quit (Quit: Leaving)
19:28:41*Jesin quit (Quit: Leaving)
19:28:59*jaco60 joined #nim
19:29:38*shodan45 quit (Quit: Konversation terminated!)
19:34:52*Ven joined #nim
19:35:49*Subspice joined #nim
19:38:22*Jesin joined #nim
19:46:50*Arrrrr quit (Read error: Connection reset by peer)
19:47:43*zepolen quit (Remote host closed the connection)
19:52:41*zepolen joined #nim
20:00:30*ephja quit (Quit: WeeChat 1.3)
20:00:33*Demos quit (Ping timeout: 240 seconds)
20:00:48*Demos joined #nim
20:09:48*dmitry_p joined #nim
20:18:54*boopsiesisaway is now known as boopsies
20:26:51*yglukhov joined #nim
20:32:01dom96http://freecontent.manning.com/nim-in-action-diagram/
20:32:26dom96(Synchronous I/O vs. Asynchronous I/O)
20:35:38*zepolen quit (Remote host closed the connection)
20:39:27ldleworkdom96: I've always thought of asynch i/o more like those "order wheels" you see in restraunts
20:40:00ldleworkwhere the cashier yells out some order and puts the receipt on a wheel
20:40:29ldleworkand then gets back the receipt and food item later
20:41:22ldleworkbut I do like the animation
20:42:16*nsf quit (Ping timeout: 255 seconds)
20:43:03*nsf joined #nim
20:43:25*Jesin quit (Quit: Leaving)
20:56:59*miko__ quit (Ping timeout: 240 seconds)
21:00:59*Demos quit (Ping timeout: 240 seconds)
21:07:13*Demos joined #nim
21:07:14*zepolen joined #nim
21:10:05*miko__ joined #nim
21:14:59*gokr joined #nim
21:42:17*wicast joined #nim
21:43:52*wicast quit (Client Quit)
21:44:16*Subspice quit ()
21:44:31*wicast joined #nim
21:48:55*wicast quit (Client Quit)
21:55:50*wicastC joined #nim
21:56:08*samdoran joined #nim
21:56:13*wicastC quit (Client Quit)
21:57:00flyxNimYAML is now at 0.2.0 and I added a DOM API
21:57:40*wicast joined #nim
21:58:17*wicast quit (Client Quit)
21:58:31*wicast joined #nim
21:58:50*wicast quit (Client Quit)
21:58:57samdoranSo, after having tried to find it myself... is there a suggested method of doing an async readline on stdin? I found an old commit that added asyncstdin to asyncfile.nim, but that seems to have been removed now
21:59:23samdoran(or I might just be messing up somewhere)
22:00:09*samdoran_ joined #nim
22:00:22*wicast joined #nim
22:03:36*samdoran quit (Ping timeout: 252 seconds)
22:04:20*samdoran_ quit (Ping timeout: 252 seconds)
22:05:26*samdoran joined #nim
22:06:24*zepolen quit (Remote host closed the connection)
22:08:41*Demon_Fox joined #nim
22:12:02*samdoran quit (Ping timeout: 252 seconds)
22:16:31*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:31:50gokrhttp://goran.krampe.se/2016/02/25/nim-meets-arduino/
22:37:09jeffc_gokr: Very Cool
22:37:10*Trustable joined #nim
22:37:28jeffc_I've been working on something similar for ARM cortex cores: https://github.com/Jeff-Ciesielski/narm
22:38:12jeffc_I have it up and running with FreeRTOS and enough driver underneath it to print it up and user printf/etc
22:38:18gokrIn fact... I am now most probably (as I write at the end) moving to try it more seriously on mbed OS.
22:39:00jeffc_I'm working on slowly peeling out the C library code I have and setting up an all Nim runtime
22:39:39gokrNice!
22:40:18gokrThis is more of the... "can I use Nim instead of C++" to program against the mbed OS or whatever.
22:40:28gokrUsing c2nim to generate the wrappers needed.
22:40:42gokrAndreas also helped me hack alloc.nim to use malloc instead of mmap.
22:41:03jeffc_Nice, that makes me glad to hear (alloc)
22:41:28gokrI should do a PR, but for now my hacked alloc.nim is in that repo.
22:41:30jeffc_I've been mulling over whether or not it would be feasible to actually add a FreeRTOS/Chibi/Mbed OS target (instead of 'none')
22:44:34*thotypous joined #nim
22:44:47*boopsies is now known as boopsiesisaway
22:47:09dom96samdoran: there is no way to read stdin asynchronously, operating systems don't support it very well. Funnily enough I explain how to get around this in my book :)
22:47:34dom96samdoran: basically you need to create a new thread and call stdin.readLine in that thread.
22:47:57dom96you can use spawn for that
22:49:03*Varriount_ quit (Ping timeout: 240 seconds)
22:49:09dom96samdoran: best to take a look at this code sample from my book: https://gist.github.com/dom96/e089d0a2cde13229cc82
22:49:12dom96hope that helps
22:49:14*Varriount joined #nim
22:51:00Varriountgokr: What horrid frankenstein have you created?!
22:51:16Varriountflyx: I like YAML (even if it is a pain to parse)
22:51:16gokrEhum? :)
22:51:34Varriount<gokr> I should do a PR, but for now my hacked alloc.nim is in that repo.
22:51:59gokrAh, well, I didn't hack it - it was Andreas, I just typed what he told me.
22:55:41*PMunch joined #nim
22:58:59*vendethiel quit (Ping timeout: 240 seconds)
23:04:12*Demos quit (Ping timeout: 250 seconds)
23:07:05*zepolen joined #nim
23:11:34*zepolen quit (Ping timeout: 250 seconds)
23:19:47*Jesin joined #nim
23:31:12*Kingsquee joined #nim
23:33:02mat4I think that is a good idea
23:33:47mat4(the FreeRTOS target)
23:37:15*mat4 quit (Quit: Leaving)
23:39:36*awsteele joined #nim
23:46:20dyce_has anyone tried the binaries on openwrt?
23:46:25dyce_nim binaries*