<< 01-05-2015 >>

00:10:18*gsingh93 quit (Ping timeout: 244 seconds)
00:12:23*Guest3414 quit (Quit: Page closed)
00:17:59ldleworkdef-: you're amazing
00:18:27*TEttinger joined #nim
00:25:30def-ldlework: thanks! I hope it works fine on Windows & Mac
00:28:49fowlill try it on windows in a bit
00:29:22ldleworka port of python's urwid module could be nice for nim maybe
00:32:23ldleworkdef-: so does your thing not use the js backend?
00:32:39ldleworkor is emscripten Nim's js backend
00:33:12Araqwe haven't got emscripten to work yet
00:33:36ldleworkAraq: it looks like def- has
00:38:28def-ldlework: that's a special case because I don't create GCed memory after the initialization
00:51:33*johnsoft quit (Ping timeout: 250 seconds)
00:52:30*johnsoft joined #nim
01:09:17*darkf joined #nim
01:10:15flaviure. google indexing the wrong version, perhaps adding a robots.txt blocking everything but `/latest/` might be effective.
01:10:32flaviu /latest can be symlinked to the latest version of the docs.
01:14:59ddl_smurfthat's pretty good (in the case of multiple versions online)
01:15:10*jholland quit (Quit: Connection closed for inactivity)
01:21:51*RaphaelHythloday joined #nim
01:24:36*BitPuffin|osx quit (Ping timeout: 240 seconds)
01:25:30RaphaelHythlodayHi, I'm new to nim, and I was wondering about manual memory management. Specifically, the reason
01:25:30RaphaelHythlodayI chose nim instaed of rust is the optional GC. But if I need performance in a specific part of my code and use manual allocs,
01:25:31RaphaelHythlodaywill the GC not turn on during that part of the program, or will it turn on less, or what? I was told it's not recommended to
01:25:31RaphaelHythlodaycompile without the GC because parts of the standard module require it.
01:26:02RaphaelHythlodayOh, sorry, I'm in emacs and used C-j for newlines, it sent individual messages
01:31:01*vbtt_ joined #nim
01:31:54*vbtt_ quit (Client Quit)
01:31:59*saml_ joined #nim
01:32:42fowldef-, nimes runs fine on windows
01:40:27fowlRaphaelHythloday, you can change gc settings http://nim-lang.org/gc.html
01:45:00RaphaelHythlodayAnother question: how do I dynamically define a type? I want to define a type where it is an uint8 if some variable n is less than 256, a uint16 if it's less than 65536, etc. N is determined at runtime.
01:45:21*brson quit (Ping timeout: 240 seconds)
01:48:44fowlis that something you can do in rust?
01:52:05fowlan enum type like U32(u32) | U16(u16) | U8(u8) is possible, but a variable cant change its size
01:53:40RaphaelHythlodayno it's size is fixed but determined at runtime initialization.
01:53:41ddl_smurf(it also would be either very slow, or it wouldn't actually spare memory)
01:54:34RaphaelHythlodayI mean it would be something like var x = if n < 256: elif n < 65536: uint16 else uint32
01:54:44RaphaelHythlodayExcept that would be wrapped in a type so that would be in the constructor for that type
01:54:51ddl_smurfbut why ?
01:54:57fowlgot an example of this in rust?
01:55:03RaphaelHythlodayNo, I've never used rust
01:55:06fowlit sounds nonsensical
01:55:16fowloh
01:55:17ddl_smurfit does - sorry
01:55:31ddl_smurf(except for serialisation perhaps, but your variable doesn't matter)
01:55:42RaphaelHythlodayNo, it's not nonsensical, it's because if I have 255 symbols why should I use 65536 or 2^32 numbers to reference them? Waste of memory
01:55:58RaphaelHythlodayIf I use a uint8 instead of a uint32 I use 4 times less memory
01:56:04ddl_smurfnot necessarily
01:56:12ddl_smurf(probably not actually)
01:56:23ddl_smurfcomputers are very good at a certain size of int
01:56:30RaphaelHythlodayI'm writing a SAT solver, if the formula has less than 256 literals I want to use a uint8, if it has less than 65536 a uint16, etc.
01:56:34ddl_smurfthat's why they say this chip is 32bit or that one is 64bit
01:57:05fowlRaphaelHythloday, well we would use a generic type constraint uint8|uint16|uint32 the function would get instantiated for any variant you pass to it
01:57:13ddl_smurfthe compiler will help you by aligning (see also packing) your uint8
01:57:57RaphaelHythlodayExactly, but it can't pack in 4 literals into one 32-bit word if each literal takes up 32 bits
01:58:14RaphaelHythlodayI would never need more than 32 bits, and I have a 64 bit chip, which means I can pack two literals per word
01:58:19ddl_smurfthe compiler will probably reserve 4 bytes and only use one for your uint8
01:58:34RaphaelHythlodayThen what's the point of the other int sizes?
01:58:55ddl_smurfplatforms, history, people who know how to tell the compiler how to pack
01:59:08RaphaelHythlodayWell why can't nim tell it to pack?
01:59:27RaphaelHythlodayPlus in java, let's say, it would be easy to do this: just put a thing in the constructor saying which size to reserve.
01:59:34ddl_smurfprobably can, but you really probably don't want
01:59:37RaphaelHythlodayNot saying I like java, I'm saying if java can do it why can't nim?
01:59:49ddl_smurfjava has no shame being slow
02:00:12RaphaelHythlodayhow would that slow anything
02:00:16fowljava runs in a virtual machine
02:00:29RaphaelHythlodayplus you can do the same thing in c++ or whatever any language that has constructors for types/objects
02:00:41ddl_smurfdid you actually measure that java only used the specified byte size for your ints ?
02:00:49RaphaelHythlodayI didn't implement it
02:00:54RaphaelHythlodayI haven't used java in a while
02:01:02ddl_smurfso why assume it doesn't align too ?
02:01:17Jehan_Not sure where Java allows that, unless you're talking about runtime code generation.
02:01:35ddl_smurfor byte[]
02:01:44RaphaelHythlodayI don't know, I don't have much experience programming at this level. I usually program in python, I'm learning nim because my sat solver has to be in a compiled language but I want python's flexibility
02:02:11Jehan_You can, of course, specify an int size at compile time in either Nim or Java (or any other language that supports variable int sizes).
02:02:25ddl_smurfno worries dude, just saying, what you want to do is in all likelyhood more expensive to manage that whatever memory you'd squeeze out of it
02:02:26Jehan_But to specify it at runtime requires that there's code for each variant.
02:02:32RaphaelHythlodaySo is there any way to use a big int if I need it and use a small int if I only have like 256 things to worry about?
02:02:54ddl_smurfyeah store as a string
02:03:10Jehan_Are you looking at an array of ints or just individual variables within an object?
02:03:17RaphaelHythlodayWhy can't it just be in the constructor? The constructor for this new type would take the size as an argument. Or does nim not have constructors like I'm thiking of?
02:03:20RaphaelHythlodaythinking
02:03:29ddl_smurfor handle the memory yourself (like byte[] and some ops)
02:03:45Jehan_The constructor for this new object would have to have code for each different type of int size.
02:04:02RaphaelHythlodayYes, I know, it would have a switch with five options: uint8 ... 16 and bigint
02:04:10RaphaelHythlodaythe switch would be based on size
02:04:12RaphaelHythlodayis this possible>
02:04:13RaphaelHythloday?
02:04:22Jehan_You can create a polymorphic object, but the polymorphism information would waste more memory than you save, unless you're talking about arrays.
02:04:45ddl_smurfseriously, this is the definition of premature optimisation, just use whatever is big enough for all, or just use a type alias or something so you can change "big enough for all" later
02:04:48RaphaelHythlodayCan I just create a type without going into OOP stuff?
02:05:03ddl_smurfbut having them all supported at runtime is wastefull and wont be nearly as optimised as you think
02:05:23RaphaelHythlodayThe only waste would be in the constructor code for the type, no?
02:05:31ddl_smurfno
02:05:40fowlno it would be at every point you access the data
02:05:44Jehan_RaphaelHythloday: No. Any code that accesses the data would have to be replicated.
02:05:58Jehan_This is because you need different machine code for each version.
02:06:02RaphaelHythlodaywhy
02:06:03RaphaelHythlodayoh
02:06:11RaphaelHythlodayso the nim wouldn't be duplicated, but the machine code would be
02:06:11RaphaelHythlodayok
02:06:23Jehan_Yes.
02:06:36ddl_smurfanother way to put it is that your switch/case thing will cost more than what you spared
02:06:59RaphaelHythlodayI guess I'll just use uint32, there's no sat formula imaginable with more than 2^32 literals
02:07:09Jehan_ddl_smurf: Well, it may save memory and create better cache behavior for large data.
02:07:19ddl_smurf(assuming you spare anything, which frankly below int32 is unlikely to be what you want, exceptions would include things like arduinos)
02:07:34RaphaelHythlodayIf I'm on a 64 bit machine, will the compiler pack two uint32's into each word?
02:07:51ddl_smurfsometimes - just trust the compiler to know your machine better
02:07:57Jehan_RaphaelHythloday: Generally, yes. Assuming the object layout permits it.
02:08:06RaphaelHythlodayHow do I write code to ensure it's permitted?
02:08:35Jehan_Generally, keep shorter int variables adjacent to each other.
02:08:38ddl_smurfyou can't garantee it wihtout going to assembler
02:08:47RaphaelHythlodayIf they're in a set, will they pack?
02:09:03ddl_smurfit might be that the compiler picks one of the ints and two other booleans from elsewhere, the compiler is good
02:09:18RaphaelHythlodayOk
02:09:31ddl_smurftrust in the compiler, not nimrod, but the gcc =)
02:09:44ddl_smurf(joke - mostly)
02:09:58RaphaelHythlodayNow I need to define the clauses in the formula as sets of literals where each literal is now uint32. Will using the regular set implementation be efficient? I don't need to hash the integers!
02:10:04ddl_smurfif may permit a suggestion for your approach to dev
02:10:09RaphaelHythlodaysure
02:10:23ddl_smurfi admire strongly your pursuit of optimisation, in fact i asked the same question as you not 2 hours earlier
02:10:43ddl_smurfbut get it to work in the most obvious way first, then go on to making it faster
02:11:05ddl_smurfthese days there is so much magic between your code and whatever the processor is doing that its basically useless to try and predict
02:11:13Jehan_There is an intsets module that is reasonably memory-efficient for sparse sets of integers, as I recall.
02:11:15RaphaelHythlodayI agree, I was just thinking about it. I haven't even seriously started writing it yet, I'm just reading about nim and these things kinda pop in m head
02:11:15ddl_smurfyou gotta measure, and for that you need working code
02:12:30ddl_smurfyeah they do, you'll develop a feeling for when they matter, don't worry, just assume they don't, keep your code simple and obvious (this helps the compiler help you), and fix things only when they break
02:12:49RaphaelHythlodayAnd Jehan_, thanks intsets sounds good
02:13:33ddl_smurfchances are excellent that if no one else picked nimrod or c, your code will be the fastest if written in the simplest way
02:13:40RaphaelHythlodayAnyway, once nim reaches 1.0 will it be effective enough to produce useful, reliable applications? cli ones at least
02:14:03RaphaelHythlodayAnd everyone else is using c or c++, but it's mostly about comparing algorithms because everyone uses their own algorithm
02:14:10ddl_smurfit is quite reliable now already, some crazy people have written NES emulators apparently
02:14:37RaphaelHythlodayMy main problem is the ecosystem, I worry that the std lib doesn't have enough stuff
02:14:56Jehan_RaphaelHythloday: I'm using Nim already to produce useful, reliable CLI applications.
02:15:24Jehan_The main issue for the near future will be library support, not the expressiveness of the language.
02:15:38Jehan_(Though there are some language improvements that I hope to see, anyway.)
02:15:46RaphaelHythlodayIf I port a std lib module from the python library to nim, will it be included?
02:15:54Jehan_Eh, or the implementation of the compiler, for that matter.
02:15:56fowlStd lib used to be bigger, we made it smaller
02:15:58RaphaelHythlodaySupposing I do a good job, I might do it for some functionality I miss from python
02:16:02RaphaelHythlodaywhy smaller?
02:16:06fowlWe have a package manager...
02:16:10Jehan_RaphaelHythloday: Depends on the quality of the port, and how central it is for Nim.
02:16:26ddl_smurfyou don't need to be in the stdlib to contribute to the ecosystem
02:16:35RaphaelHythlodayWhere is the repository for the package manager?
02:17:04Jehan_I'm still advocating for a "battery pack" library where you get tons of useful stuff with a single install without having to grab lots of packages individually. :)
02:17:06ddl_smurftraditionally components that get to the stdlib are exhaustively tested veteran type stuff, in the c++ world for example, boost is the stuff that didn't make it into the STL (or is in the process of)
02:17:30RaphaelHythlodayI agree with you, I have like 100GB on my laptop, why should I be picky about putting packages on it?
02:17:35Jehan_RaphaelHythloday: https://github.com/nim-lang/packages
02:17:43RaphaelHythlodayThe only problem is that when you compile standard.nim it can take a long time if the std lib is huge
02:17:52RaphaelHythlodayso that's an argument for making it small
02:18:05Jehan_RaphaelHythloday: Not really, it compiles only the modules that are imported.
02:18:06ddl_smurfthere's that, and there's what you want included in your compilations
02:18:14Jehan_Only system.nim is imported by default.
02:18:28RaphaelHythlodaysorry, system.nim
02:18:41ddl_smurf*my bad, Jehan_ is right
02:20:01RaphaelHythlodayCan I keep a version of system.nim compiled in my nimcache with and without -d:release so that when I change the flags on my code it won't recompile system?
02:20:33ddl_smurfi like the kid =)
02:20:41ddl_smurfgood question ?
02:20:47RaphaelHythlodayYa, I'm in high school sorry if I'm a noob
02:21:10ddl_smurfstill its a good question, i'd like the answer too, if its based on what i know its no
02:21:25RaphaelHythlodayI hate programming at low level because I'm more interested in TAOCP type stuff than bit twiddling, that's why I really like nim
02:21:39fowlYou have to write very complicated macros before you start to slow down compilation
02:21:48RaphaelHythlodayI just don't believe it's possible for it to be as fast as c, it's as expressive as python and it has lisp macros! I'm a huge fan of lisp
02:21:58ddl_smurfit is c
02:22:34RaphaelHythlodayit looks like python with lisp to me, I don't see the c poking through at all
02:23:00RaphaelHythlodayOh, here's another question: how do I make a script to automatically update nim for me from github? (stable version)
02:23:01ddl_smurfyou will
02:23:07Jehan_RaphaelHythloday: C is the backend it gets compiled to, and the type system is designed so that most stuff maps to C in a fairly straightforward fashion.
02:23:10ddl_smurf(you already did when you talked about int size)
02:23:19Jehan_This is also why interop via importc is pretty easy.
02:23:32RaphaelHythlodayYa, why does the std lib matter if you can import glibc?
02:23:58ddl_smurfglibc refused our proposals to rewrite in nim and have nim interfaces
02:24:19RaphaelHythlodayNot rewrite, just wrap
02:24:35ddl_smurfthat is mostly what the stdlib does
02:24:40RaphaelHythlodayI mean, it's supposed to be easy to use c libs
02:24:44RaphaelHythlodaywhy can't i do cimport glibc
02:24:45RaphaelHythloday?
02:24:49ddl_smurfwith some sprinklings of magic so you never have to see strcat again
02:25:01RaphaelHythlodayNever saw it to start out with, I'm a different generation
02:25:04ddl_smurfyou can
02:25:54RaphaelHythlodayHow many people do you think use nim but haven't contributed? That is, how many users who aren't also the creators?
02:26:06ddl_smurfglibc just doesn't get you very far, i'm afraid as far as string handling is concerned in basic c, that leaves you with strcat and friends
02:26:29RaphaelHythlodayWell, I mean let's say can I import boost if I compile with c++ as a backend?
02:27:20ddl_smurfyou'd need a lot of very delicate wrapping code
02:27:35ddl_smurf(that i don't think cimport will help you with, not in c++)
02:27:49ddl_smurfbut ultimately i'd venture its not impossible
02:28:05fowlC++ support is better
02:28:15RaphaelHythlodayIf nim becomes widely popular, will people write a compiler that directly compiles nim to machine code like gcc?
02:28:24fowlSee the project urhonimo
02:28:34ddl_smurfbut at that point you're probably better off just working in c++ or including nim into your c++ objects
02:29:01fowlAnd someone was working on a native code generator
02:29:05ddl_smurffowl: you want to recommend he try and import boost ?
02:29:23RaphaelHythlodayI heard a lot of bad things about boost btw
02:29:30ddl_smurfi mean if anything tests your c++ parser, boost will be it
02:29:35RaphaelHythlodayand about c++ generall
02:29:42fowlNo boost is a hairy mess
02:29:49fowlIt scares me
02:29:53ddl_smurfmake your own mind up
02:30:01ddl_smurfit suits you or not
02:30:13ddl_smurfthey are tools, they are suited to purposes, they are not generally good or bad
02:30:18*Helios__ joined #nim
02:30:34RaphaelHythlodayHow long do you think it will be until the GPU backend is working? It doesn't make much sense to have a parallel language that can't run on GPUs
02:30:39ddl_smurf(I rather like Boost, which also, should scare you)
02:30:54fowlI have my own std lib BTW it has modules mostly related to game dev
02:31:06ddl_smurfcan i look ?
02:31:11RaphaelHythlodayfowl are they on nimble?
02:31:31fowlGithub.com/fowlmouth/nimlibs
02:32:00ddl_smurfhttp://www.reddit.com/r/nim wow 500 isn't half bad
02:32:10Jehan_RaphaelHythloday: There's lots of parallel stuff that isn't very GPU-friendly, actually.
02:32:32RaphaelHythlodayI've built stuff on CUDA before. When I talk parallel I mean a giant reduce/scan/filter type operation
02:32:55fowlThere's a cool project called nimx compiles to android iOS desktop or js
02:33:16ddl_smurfCopyright (c) 2012 fowlmouth <-- lol i'm not sure how legally binding that will be =)
02:33:55fowlIts not meant to be legally binding
02:35:40ddl_smurfthat still uses quite a bit of the stdlib, but its a nice assortment, thx a lot =)
02:38:13fowlNims new macros.getType() is the best new feature in 0.11.0
02:38:40RaphaelHythlodayWhat are the advantages of nim over rust?
02:38:43*darkf_ joined #nim
02:38:58*darkf quit (Ping timeout: 265 seconds)
02:39:22ddl_smurfmacros were really buggy last time i tried (like years ago), i think i definitely have to get back on
02:40:07ddl_smurfrusts' ownership model bugs the fuck out of me
02:40:20ddl_smurfi love the concept, but in practice its a major PIA
02:40:46fowlMetaprogramming
02:41:12ddl_smurfYMMV, the strengths are different, they are both tools better suited at different stuff
02:41:38ddl_smurfbut yeah the macros are awesome, though if that's what you like, racket would be better for instance
02:41:43fowlAnd the GC is not to be feared, you should try to stress it out, the "ceiling" is much higher than python
02:42:29ddl_smurfmost beginners who try to do memory management manually end up doing a phenomenally worse job than the GC any way, and when its done right, the improvement is marginal
02:43:15RaphaelHythlodayHow are lisp macros different from nim macros? Whenever I read lisp texts it says "lisp has to be this ugly so that the macros can modify the ast". that would imply nim macros are inferior.
02:43:40ddl_smurfsince the language is more complicated
02:43:53ddl_smurfthe macro's code that transforms said language is that much more complicated
02:43:57fowlIn Nim macros you directly build ast
02:44:11ddl_smurf(instead of symbol literal and list you get ifs and whens and stuff)
02:44:20fowlTemplates are simpler substitution mechanisms
02:44:32RaphaelHythlodayBut nim and lisp macros are equally powerful?
02:44:39ddl_smurf(to be fair in lisp, lisp and the ast are one)
02:44:57ddl_smurfbut macros in lisp still have runtime cost, because lisp isn't compiled into c
02:45:19RaphaelHythlodayWell, it's compiled into lisp bytecode and the macros are expanded at compile-time
02:45:20ddl_smurfthe c code you generate contains the resolution of executing your macros
02:46:04ddl_smurfwell yeah but with lisp compile-time and run-time are things you pay at each run (there are some caches like byte code but still)
02:46:59*gsingh93 joined #nim
02:48:22ddl_smurf"equally powerful" is ill defined, lisp may be more elegant/minimalistic, nim may be more expressive/short
02:48:51ddl_smurfbut if both compilers are working correctly, both macro systems are turing complete
02:49:16RaphaelHythlodayDoes nim have map-in-place? That is, map(func,seq) but it modifies seq in place.
02:49:21*xtagon joined #nim
02:49:23RaphaelHythlodayI can't find it
02:49:44fowlIts called map
02:50:00fowlIt takes a diff function type
02:50:26RaphaelHythlodaySo then what function map's and returns a new seq?
02:50:59fowlThe one with a sig nature like proc(a):b
02:51:06*vendethiel joined #nim
02:51:25*nande quit (Read error: Connection reset by peer)
02:51:31fowlThere is the chance to change type here
02:52:00fowlMutate in place is proc(var a)
02:52:08RaphaelHythlodayOh, I found it, it's in system
02:52:12RaphaelHythlodayDoes nim have scan?
02:52:25ddl_smurfscanf ?
02:52:35ddl_smurfhttps://github.com/fowlmouth/nimlibs/blob/master/fowltek%2Fparsetools%2Fg_lex.nim ?
02:53:03fowlNo that's old and I'm going to delete it asap
02:53:45ddl_smurfwas wondering about the g_* =)
02:53:49fowlIts probably worthless :p I have a newer parsing lib that let's you build ast directly
02:54:35ddl_smurfyou merged the lexer parser and builder ?
02:54:55RaphaelHythlodayNo, scan is like filter and reduce, it's a primitive
02:55:09RaphaelHythlodayI used it a lot in CUDA, it's in all the libs and stuff
02:55:18ddl_smurfin what lang ?
02:55:26RaphaelHythlodayCUDA is nvidia's gpu extension to C
02:55:45fowlRaphael sequtils maybe
02:55:48ddl_smurfwe're outside of my competence
02:56:03RaphaelHythlodayIt's only useful for parallel computing, basically scan(+, [1,2,3,4,5]) = [1,3,6,10,15]
02:56:14flaviu"map"?
02:56:25flaviuoh, I see. Nm.
02:56:29ddl_smurfmap and a closure;ll do ya
02:57:08flaviuOr a fold will also work if you want to be fancy.
02:58:08RaphaelHythlodayYes, the fold is the same thing
02:58:21*saml_ quit (Remote host closed the connection)
02:58:26RaphaelHythlodayThough someone should implement the parallel algorithm for it for the std lib
02:58:31fowlRaphaelHythloday: Araq would welcome any GPU programming contributions to the std lib
02:58:33ddl_smurfit's good to be fancy, if there's a system function that'll do what you need its best to use it even if the alternative code is shorter, the system knows best
02:59:08fowlI say that faithfully in a logged channel
02:59:52fowlThere is an opencl target that might need some love
02:59:59RaphaelHythlodayWell, at least parallel thread-wise. I mean, map for example has a trivial parallel implementation. Does nim spawn a bunch of threads to do it? It should! That's the fastest way. There should by a pmap, preduce, pfold, etc that do the same thing but spawn as many threads as cores to do it.
03:00:01flaviuwrt. adding it to the stdlib, that's a poor idea. Stdlib needs polish, not new toys.
03:00:45ddl_smurfgpu is leaving the toy world, sure could use some if it weren't such an annoyance
03:01:19RaphaelHythlodayWhy can't nim automatically do parallel stuff on the cpu whenever possible?
03:01:28ddl_smurfanything that is good on gpu would also be good for the whole multicore trend thing too no ?
03:01:33RaphaelHythlodayyes
03:01:43RaphaelHythloday8 core cpu = perhaps 10 core gpu
03:01:53RaphaelHythlodaybecause gpu cores are really weak, but there are many of them
03:02:04flaviuddl_smurf: I'm not against the GPU aspect, I'm against haphazardly adding things to the stdlib without a clear design.
03:02:05ddl_smurfoh i've written shaders, just not cuda
03:02:11RaphaelHythlodaymost graphics cards have like 12 or 16 cores
03:02:12Jehan_ddl_smurf: Really depends on your problem domain.
03:02:47ddl_smurfflaviu: yeah, but is there a clear design ?
03:02:58ddl_smurfJehan_: obviously, but so does sequtils
03:03:04RaphaelHythlodayMy question isn't about GPUs though. I'm asking why standard functions like map can't automatically spawn extra threads to work in parallel? Optionally, of course
03:03:10Jehan_sequtils is pretty general.
03:03:13ddl_smurfbesides if the compiler indeed doesn't look an non imported stuff, its free
03:03:32Jehan_RaphaelHythloday: Umm. First of all, because it may be slower.
03:03:44Jehan_Second, because you may not want to actually use more cores.
03:04:01Jehan_Because, say, if you do it to much, your UI grinds to a halt.
03:04:03ddl_smurfRaphaelHythloday: they could, but nim is still a bit young with regards to threading and doesn't have a dispatch system
03:04:05Jehan_too*
03:04:09RaphaelHythlodayOptionall, though. There would be an extra argument to map, reduce, etc like map(stuff, numthreads = 0) and you can change numthreads
03:04:25flaviuddl_smurf: Even if no one uses it, it is not free. It'll have non-zero maintenance cost to prevent it from rotting, along with other similar costs.
03:04:33Jehan_RaphaelHythloday: You don't want to make that part of the standard map() implementation but a separate module.
03:05:06RaphaelHythlodayThe program that I want to make this summer requires parallelism, though. Is nim not mature for that yet?
03:05:08Jehan_Actually, you probably even want to give it a different name to alert the programmer to the fact that it does use threads.
03:05:14ddl_smurfflaviu: that cost has most certainly not been paid outside of use, there is code rot every where, cuda will be as maintained as its used
03:05:14RaphaelHythlodayya, like pmap or preduce
03:05:51flaviuddl_smurf: We're approaching it from different directions. I'm looking at this from an API design point of view. API Consistency, simplicity, so on.
03:06:04Jehan_RaphaelHythloday: Depends. There are still considerable gaps in the library support for parallelism, IMHO. Some things are easy, other means writing a lot of code yourself.
03:06:26RaphaelHythlodaySay I just need to spawn 64 threads that don't communicate. Will that be hard?
03:06:31Jehan_others mean*
03:06:40Jehan_RaphaelHythloday: That should be pretty easy.
03:06:46ddl_smurfflaviu: 'm just saying that if the only criterion is consistency/generality than its receeding
03:06:51RaphaelHythlodayWill it be as efficient as openMP?
03:06:53Jehan_What's hard is sharing reference-heavy data structures.
03:07:12Jehan_openMP isn't particularly magical.
03:07:13RaphaelHythlodayMy program just needs to make as many threads as cores to max out the cpu
03:07:15flaviuddl_smurf: I don't understand your statement.
03:07:26RaphaelHythlodayAnd then each thread works on its own
03:07:31Jehan_RaphaelHythloday: Yeah, that should be pretty straightforward.
03:07:35RaphaelHythlodayGreat
03:07:40RaphaelHythlodayHow is that implemented? pthreads?
03:07:45Jehan_As I said, it's sharing complicated data structures that's non-trivial.
03:07:53Jehan_Yes, on Posix systems, it's pthreads.
03:08:29RaphaelHythlodayCool. Anyway, thanks for all your help Jehan_ fowl ddl_smurf I have to go.
03:08:38*RaphaelHythloday left #nim ("ERC Version 5.3 (IRC client for Emacs)")
03:09:59flaviuUnfortunately, I'm going to have to say goodbye too. night all.
03:10:07ddl_smurfflaviu: well i don't think there is cost, and from a design point of view the reasons to exclude cuda you've advanced was that you need a clear design, and api consistency - in that point of view the design is idealistic and so far simply absent, the consistency aspect i undestand as regarding a theme of general purposeness of the stdlib, to which i think that gpus are tending too
03:10:09fowlgn flaviu
03:10:16ddl_smurf++
03:37:59*darkf_ is now known as darkf
03:38:22*brson joined #nim
03:38:42*Jehan_ quit (Quit: Leaving)
03:56:46*gsingh93 quit (Ping timeout: 256 seconds)
04:00:19*Hythloday joined #nim
04:02:24*Hythloday left #nim (#nim)
04:07:21*vendethiel quit (Ping timeout: 240 seconds)
04:20:13*Jesin quit (Quit: Leaving)
04:23:22*vikaton quit (Quit: Connection closed for inactivity)
04:25:09*msmith491 joined #nim
04:42:04*msmith491 quit (Ping timeout: 246 seconds)
04:48:30*brson quit (Ping timeout: 265 seconds)
04:53:22*reactormonk joined #nim
05:05:34*gsingh93 joined #nim
05:14:14*vendethiel joined #nim
05:20:50*xtagon quit (Read error: Connection reset by peer)
05:38:20*vendethiel quit (Ping timeout: 252 seconds)
05:39:28*yglukhov joined #nim
05:42:57*iamd3vil joined #nim
06:06:06*yymoto2 joined #nim
06:10:04reactormonkpigmej, does the epc stuff work as expected?
06:11:21*yymoto2 quit (Quit: leaving)
06:11:23*HakanD___ joined #nim
06:11:39*yymoto2 joined #nim
06:21:11*Ven joined #nim
06:23:48*yymoto2 quit (Quit: Lost terminal)
06:27:52HakanD___morning
06:50:12*xificurC_ quit (Quit: WeeChat 1.1.1)
06:50:31*xificurC joined #nim
06:51:05*vendethiel joined #nim
07:03:27*iamd3vil quit (Quit: Leaving)
07:09:23*Helios__ quit (Quit: Page closed)
07:10:07*johnsoft quit (Ping timeout: 265 seconds)
07:10:43*johnsoft joined #nim
07:16:04*vendethiel quit (Ping timeout: 245 seconds)
07:22:27*Jesin joined #nim
07:29:26*silven quit (Ping timeout: 252 seconds)
07:43:26*ddl_smurf quit (Quit: ddl_smurf)
07:52:18*Jesin quit (Quit: Leaving)
07:55:05*Jesin joined #nim
08:04:47*coffeepot joined #nim
08:10:13*iamd3vil joined #nim
08:15:40*silven joined #nim
08:23:16iamd3vilCan anyone tell me how can I make reading lines from a file faster? It's too slow now.
08:27:52*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:30:36HakanD___iamd3vil: have you seen http://forum.nim-lang.org/t/1164 ?
08:31:19*HakanD___ is now known as HakanD
08:35:22coffeepotbtw, why does Nim prefer code to be inside a proc - something to do with globals?
08:37:32*Ven joined #nim
08:45:12*vendethiel joined #nim
08:45:13*Matthias247 joined #nim
08:58:25*BlaXpirit joined #nim
08:59:37*ingsoc joined #nim
09:12:24*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:12:43*Ven joined #nim
09:21:40*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:22:57*Sembei quit (Remote host closed the connection)
09:30:52*vendethiel quit (Ping timeout: 272 seconds)
09:33:19Araqcoffeepot: exactly
09:46:32coffeepotare globals simply slower because they can't be optimised to stack? Just guessing :)
09:47:09Araqthe compiler cannot optimize globals well
09:47:14coffeepotbtw finally getting connections to sql server working in nim, yay!
09:47:32coffeepotAraq, ok that makes sense
09:47:38Araqcool, make it a nimble package please
09:48:46coffeepotwill do, but it'll need some work to make functional as a lib so it'll be a while yet (i'm off most of next week and don't have sql server set up at home)
09:54:26repaxcoffeepot: A frequently read global is a sure way to blow the cache. Consider passing the value to the proc.
09:55:07coffeepotrepax I thought it'd be something to do with that. I'm kinda surprised it makes so much difference when reading lines from a file though, as per the linked thread above
10:03:16*matkuki joined #nim
10:03:24*matkuki quit (Client Quit)
10:05:45coffeepoton second read of thread putting into a proc isn't really what made a difference to file read speed, which makes sense.
10:17:22*TEttinger quit (Ping timeout: 252 seconds)
10:24:03*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:28:07*Ven joined #nim
11:04:48*Trustable joined #nim
11:05:11novistgokr: poke. it was quite a while since last urhonimo update. mind updating public repo some time? ;)
11:05:33*dom96_ joined #nim
11:14:50*UberLambda joined #nim
11:21:19*Sharcho joined #nim
11:23:43*UberLambda quit (Quit: Leaving)
11:23:46Sharchoiamd3vil: are you using the lines method, it's reasonably fast that way? http://rosettacode.org/wiki/Read_a_file_line_by_line#Nim
11:25:02def-Sharcho: It's probably slow on Windows because my faster method didn't work and I don't have Windows to test
11:27:32*iamd3vil quit (Ping timeout: 272 seconds)
11:32:57Sharchodef-: you can download Windows VMs for VirtualBox from https://www.modern.ie/en-gb
11:34:28*vendethiel joined #nim
11:39:08*banister joined #nim
11:48:22*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:55:23*BitPuffin|osx joined #nim
11:58:27*vendethiel quit (Ping timeout: 250 seconds)
12:03:44*vendethiel joined #nim
12:05:46*Kingsquee quit (Quit: Konversation terminated!)
12:05:54*banister quit (Ping timeout: 265 seconds)
12:08:00*BlaXpirit_ joined #nim
12:08:09*BlaXpirit quit (Ping timeout: 240 seconds)
12:09:36*vikaton joined #nim
12:13:48*Strikecarl joined #nim
12:14:57StrikecarlHow do i get the lowest number (int) in an openArray?
12:15:39Araqmin
12:16:06Strikecarlwhat lib?
12:16:12Strikecarlis it in core?
12:16:22Araqsystem.min
12:16:29Strikecarlty
12:18:07*iamd3vil joined #nim
12:20:05Strikecarlthis might sound a bit stupid
12:20:06Strikecarlbut
12:20:21Strikecarl"e:\nim\nim.nim(3, 11) Error: expression 'lowest(kek)' has no type (or is ambiguous)"
12:20:31Strikecarlproc lowest*(x: openArray[int]) = echo min(x)
12:20:41StrikecarlCan anyone hint me what i did wrong
12:20:44Strikecarldo i have to do like
12:20:46def-you're not returning the result
12:20:48Strikecarl(x: openArray)
12:21:13StrikecarlFUCK nvm
12:21:16Strikecarlforget what i said (facepalm)
12:21:30StrikecarlProtip: don't use 2 "echo"'s lol
12:25:06StrikecarlHow do i make a like uh, proc that plusses an openarray with itself (for my calculator lib) so the "plus" proc isn't limited to x amount of times it pluses?
12:25:44def-Strikecarl: easier to work with seqs then, I think
12:26:19StrikecarlI'll try.
12:26:54*Amrykid2 is now known as Amrykid
12:27:00*Amrykid quit (Changing host)
12:27:00*Amrykid joined #nim
12:27:42*Trustable quit (Remote host closed the connection)
12:37:48*milosn quit (Quit: leaving)
12:38:42*filcuc joined #nim
12:42:56*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
12:47:38novistin c i can do like some_struct ss = { 0 }; to put it on stack and initialize to zero. nice shortcut. is there any shortcut for that in nim? calling explicitly zeroMem() is awkward
12:48:10def-novist: var ss: someObj?
12:48:32def-Everything is initialized to zero by default in Nim
12:49:22novistoh damn nice, thanks
12:50:03def-you can use {.noinit.} if you really don't want it to be initialized, but it's very rarely necessary
12:54:32*mpthrapp joined #nim
12:58:42*dom96_ quit (Quit: Page closed)
13:09:35flyxwhen I generate a proc with a macro, I get an error when I add the pragma compileTime to it. is that a compiler restriction?
13:10:24def-flyx: Can you use it at compile time without the pragma? Can you try the immediate pragma?
13:10:30*kapil___ joined #nim
13:10:45flyximmediate is deprecated, isn't it
13:11:22def-Haven't heard of that
13:11:41BlaXpirit_i did hear of that, and it made no sense to me
13:11:53BlaXpirit_seeing as most of my macros are immediate
13:11:55flyxI can not use iti at compileTime without the pragma, because I use NimNode in there, which is only available at compile time
13:12:04BlaXpirit_flyx, but it's fine
13:12:15BlaXpirit_you should just put the code that calls the macro inside static:
13:12:44flyxthe code that calls the macro is in another macro
13:12:50flyxthat's not the problem
13:13:04BlaXpirit_make every macro immediate, i dunno
13:13:26BlaXpirit_let's not care about some secretive deprecation
13:13:28BlaXpirit_for now
13:13:56*iamd3vil quit (Ping timeout: 246 seconds)
13:13:57*filcuc quit (Ping timeout: 256 seconds)
13:14:24Araqflyx: report it
13:14:30flyxAraq: I will
13:15:03Araqand fyi 'immediate' will be deprecated once the alternative mechanisms are refined
13:15:20Araqand it'll be available for months anyway
13:15:31Araqif not years, we have lots of code that uses it
13:19:24flyxhmm, it works when I create a minimal example. seems like I have to dig deeper to find the issue
13:33:30flyxah okay, it doesn't work because it's an iterator
13:33:46flyxis that intended or a missing feature?
13:34:50Araqa compile-time iterator?
13:35:07flyxyes. I don't need it at runtime
13:35:19Araqit has no runtime representation anyway
13:35:27Araqso there is no need for it
13:35:42Araqunless you mean a closure iterator
13:35:43flyxah okay, then the pragma is simply unnecessary
13:35:55Araqbut these don't work at compile-time yet
13:36:32flyxit's not a closure iterator
13:36:39Araqvery well then
13:36:54flyxeverything already works without applying pragmas \o/
13:37:19*Sharcho quit (Ping timeout: 255 seconds)
13:40:13*Sharcho joined #nim
13:46:29*Sharcho quit (Ping timeout: 245 seconds)
13:55:26*ddl_smurf joined #nim
13:57:15*HakanD quit (Quit: Be back later ...)
14:00:06*thotypous quit (Quit: WeeChat 1.1.1)
14:02:56*thotypous joined #nim
14:11:31*yglukhov_ joined #nim
14:13:52*yglukhov quit (Ping timeout: 256 seconds)
14:14:32*darkf quit (Quit: Leaving)
14:16:46gokrnovist: We have a few more commits in our internal repo of Urhonimo, but not much. But we will try to push it next week
14:18:11*HakanD joined #nim
14:18:53*jefus is now known as jefusafk
14:19:45*nimnoob123 joined #nim
14:24:33*iamd3vil joined #nim
14:27:45gokrdef-: That's cool stuff :)
14:28:47*Strikecarl joined #nim
14:28:48Strikecarlwut, is this a bug?
14:28:50Strikecarlsource: http://pastebin.com/raw.php?i=LdJGR1st
14:28:53*Matthias247 quit (Read error: Connection reset by peer)
14:28:54Strikecarlwhen i run
14:29:00Strikecarlit returns 7
14:29:07Strikecarllogic?
14:30:06*yymoto2 joined #nim
14:31:29def-Strikecarl: high is not max
14:31:39def-high is the highest index
14:31:48StrikecarlSo like, 55 is less than 9?
14:31:49def-len-1
14:32:09def-Strikecarl: high does NOT calculate the maximum, it returns len-1
14:32:22def-What you want is max()
14:32:44Strikecarloh lol
14:32:48Strikecarlluv u
14:32:48Strikecarlc:
14:33:16def-gokr: thanks!
14:33:42gokrdef-: Did you basically port the Go version or did you write it more from scratch? How does it compare to the Go version?
14:34:03BlaXpirit_what
14:34:23nimnoob123im so happy, thanks def- for that link you posted on reddit regarding c2nim
14:34:39nimnoob123I gave up on gorillaAudio, but I did manage to get sdl2_mixer working
14:35:21gokrBlaXpirit_: https://github.com/def-/nimes
14:35:22def-gokr: At the start I wrote a lot myself. Later I mainly ported the Go code
14:37:37gokrHow does it compare to the Go version? I mean, any specific advantages here with Nim?
14:38:07StrikecarlHow to calculate PI at compile?
14:38:16def-gokr: performance is better without changing anything, it compiles to JS with emscripten and Android
14:38:35gokrYeah, those I kinda suspected ought to be advantages.
14:38:58gokrAgain, going via C/C++ has its nice advantages.
14:39:10gokrWill you blog about it?
14:40:05def-I thought the github page had all the important information, so I just posted a stub in my blog: http://hookrace.net/blog/nimes/
14:41:29gokrIts interesting as a use case - since we can compare with the Go version.
14:42:48*yymoto2 quit (Quit: Lost terminal)
14:42:59def-Compile time is also similar to the Go version
14:43:15gokrThat's quite cool - since Go is famous for that.
14:45:53*jholland joined #nim
14:46:04coffeepotis it common for the c cache files to get corrupted?
14:46:17def-coffeepot: sometimes happens, but i could never reproduce
14:46:36coffeepotyeah i was coding away and suddenly this:
14:46:37coffeepotC:\Nim\lib/nimbase.h:393:13: error: size of array 'assert_numbits' is negative
14:46:37coffeepot typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
14:46:37coffeepot ^
14:46:37coffeepotc:\nimproj\odbc\nimcache\odbc.c: In function 'performquery_105552':
14:46:37coffeepotc:\nimproj\odbc\nimcache\odbc.c:1235:95: error: expected expression before '?' token
14:46:38coffeepot printf("%s%s\015\012", ((NimStringDesc*) &TMP231)? (((NimStringDesc*) &TMP231))->data:"nil", ? ()->data:"nil");
14:46:52def-that sounds like 64/32 bit problem
14:47:28coffeepotthat's weird, i've been doing this all day and it just suddenly happened on a compile
14:47:43coffeepoti'm on 64 bit pc, got 64 bit nim 0.11
14:47:56def-you didn't throw in a --cpu:i386?
14:48:32coffeepotnooooo, didn't even know of such a thing
14:48:52coffeepotinterestingly sublime gives a slightly different message (previous was aporia):
14:48:53coffeepotc:\nimproj\odbc\nimcache\odbc.c: In function 'performquery_105552':
14:48:54coffeepotc:\nimproj\odbc\nimcache\odbc.c:1235:95: error: expected expression before '?' token
14:48:54coffeepot printf("%s%s\015\012", ((NimStringDesc*) &TMP231)? (((NimStringDesc*) &TMP231))->data:"nil", ? ()->data:"nil");
14:49:09ddl_smurf(that is definitely a C compiler-time pointer width assertion)
14:50:12gokrThat last part looks like incomplete code - so bug in Nim compiler?
14:50:29ddl_smurf(so that's a size(int) != size(void*), i'd agree with def - something you're importing now is checking for it, i don't think its corruption)
14:51:02def-gokr: ah, and the resulting binary is 191 KB vs 16 MB for Go
14:51:12gokrBut... ? ()->data:"nil" ... looks incomplete.
14:51:14coffeepotweird. It happens when I removed an echo statement o_O
14:51:31ddl_smurfgokr: definitely, but with a compiler throwing earlier, better sort out in order
14:51:55gokrah
14:52:28Araqit's not incomplete but there is a ',' too much
14:52:43Araqmaybe a glitch in the 'echo' codegen part
14:52:59gokrBut... there are two %s%s - so ... ?
14:53:24Araqhrm true
14:53:55def-gokr: hm, maybe I should write an article about it after all
14:54:20ddl_smurfi think its supposed to output X ? (X)->data : "nil", and the second X is empty for some reason
14:54:38*iamd3vil quit (Ping timeout: 272 seconds)
14:55:03coffeepoti'll try and cobble together the fragment where it happened...
14:56:11*HakanD_ joined #nim
14:57:58*iamd3vil joined #nim
14:58:47coffeepothttps://gist.github.com/anonymous/b04a5b4dfc32205d9a12
14:59:36ddl_smurf(just for my curiosity: is odbc seriously still used ?)
14:59:42coffeepotsadly yes :(
14:59:49ddl_smurfsorry bro
14:59:53*HakanD quit (Ping timeout: 276 seconds)
15:00:11coffeepothad this discussion the other day - MS is depreciating everything except ADO.NET and ODBC
15:00:29*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
15:00:34coffeepotcan't realistically use .NET
15:00:38ddl_smurfwhat else was there ?
15:01:36coffeepotOLE DB pretty much was the other option. Ideally I'd want to use native client but turns out NaCl is just either ADO.NET or ODBC in a wrapper now
15:02:11coffeepotODBC is a total PTA compared to the other wrappers
15:02:16coffeepotPITA
15:05:03coffeepotbasically MS wants us to all use ado :(
15:06:40*Varriount_ joined #nim
15:09:03coffeepotif anyone's interested i could past the whole module up 'cos I now can't compile it at all :/
15:09:49Araqyup do it
15:09:49*Varriount quit (Ping timeout: 245 seconds)
15:10:07*Sharcho joined #nim
15:10:13coffeepotok - this is just me hacking it out so be prepared for hacky crap code :D
15:10:14*iamd3vil quit (Ping timeout: 245 seconds)
15:10:34*iamd3vil joined #nim
15:11:05coffeepothttps://gist.github.com/anonymous/925bd88b8f17ff7af332
15:11:27nimnoob123https://github.com/nim-lang/sdl2/pull/41
15:12:17nimnoob123Well that was fun.
15:12:55coffeepotat least the issue seems reproducible
15:13:29reactormonknimnoob123, c2nim fun?
15:13:57*jefusafk is now known as jefus
15:14:06nimnoob123c2nim? i mean the fun part was making sure things worked lol, but the process leading up to that wasn't :(
15:15:03nimnoob123I think I learned something from doing that though
15:16:22coffeepotreposted here https://gist.github.com/anonymous/ef75e830e3346d25a886
15:17:30coffeepotlol I am not a clever man https://gist.github.com/anonymous/d4beab152b8444e50b49
15:19:52ddl_smurfole db - i'd feel nostalgic if it werent for the vomit after taste
15:20:44coffeepotjust think yourself lucky you don't have to use it! Hopefully I can abstract all the rubbish out to just do the job without too much hassle.
15:21:08coffeepotaside from the interfacting woes I guess it's not too bad. ODBC isn't apparently slow
15:21:35ddl_smurfoh no, all these techs designed for 64k machines run great now
15:22:11ddl_smurfi mean it worked on a pentium 75, 8mg ram - seriously it did
15:22:57ddl_smurfi dont get how NaCl is related to that, you calling odbc from a browser ?
15:23:59coffeepotnope, actually my end goal is to have some kind of ORM that'll work with SQL Server so I can start using it at work for serving up json or xml or something
15:24:18coffeepotbut for now i just want to perform a query!
15:24:29ddl_smurfoh that's cool, a kind of document db ?
15:25:29coffeepotactually i'd like to make a system api for a product
15:25:42coffeepotto be used over the intranet
15:25:45ddl_smurfmaybe you can try switching everything to 32bit (this means compilation flags, but also how you run the exe, and the DSN's are separate so you have to use sysWOW64\odbcad32.exe instead)
15:26:19coffeepotthat doesn't explain why it was working fine and then went kaput
15:26:31coffeepotbeen coding it on and off for a while now
15:27:00ddl_smurfa million things could have changed, if you don't remember, diagnosing at this point will be hard
15:27:17coffeepotwell i can get it to compile now so i guess i found where the issue is
15:27:23coffeepoti'll carry on narrowing it down
15:27:31ddl_smurfgl =)
15:31:46coffeepotthis causes the problem: echo "hdnle ", qry.handle
15:32:10coffeepothandle: TSqlHStmt (basically a pointer IIRC)
15:32:26coffeepotyou know i think i know what it is
15:32:31ddl_smurfi don't think there is ever a valid reason to generate unparseable C, so this is a compiler bug
15:32:44coffeepoti agree
15:33:03coffeepotthe problem is my hacky print proc
15:33:16coffeepotproc `$`(x: TSqlHandle) =
15:33:16coffeepot if x != nil:
15:33:16coffeepot var data = cast[ptr int](x)[]
15:33:16coffeepot echo data
15:33:16coffeepot else:
15:33:17coffeepot echo "nil"
15:33:21coffeepotthat's the cause
15:33:41ddl_smurfthat's is exactly the statement i wrote above
15:34:07*HakanD_ quit (Quit: Be back later ...)
15:36:03nimnoob123hey def- if you can check that PR to let me know if that's what you wanted
15:36:57ddl_smurfthat cast kind of has an odd smell, like its confusing int and pointer, but i'm very rusty in nim sorry (no pun intended)
15:37:03def-nimnoob123: the top looks fine, and now you can remove cdecl, dynlib: LibName from all the procs
15:37:20nimnoob123alright, sec
15:37:53*grncdr joined #nim
15:37:56def-nimnoob123: the reason I'm asking for static building is that it's the preferred way to build SDL2 programs with emscripten
15:38:05nimnoob123def- is SDL_STATIC case sensitive?
15:38:16nimnoob123because you use two different cases on some of your changes
15:38:16def-nimnoob123: I don't think so, but I never tested
15:38:26coffeepotyeah the cast is dumb, i just wanted to display the value of the pointer, which you can do with echo repr(ptr)
15:38:31def-nimnoob123: that's bad anyway, let me fix that
15:38:36coffeepotactually totally forgot the code was in there :/
15:38:39grncdris it possible to use have an identical field in multiple object variants?
15:39:10def-grncdr: in some cases, yes
15:39:45def-https://www.reddit.com/r/programming/comments/2tedjb/what_makes_nim_practical/cnyko39
15:40:35def-nimnoob123: Should be SDL_Static, that's what's mostly used
15:40:50grncdrdef-: so the comment replying to yours says it's not possible
15:40:52nimnoob123alright, thanks will update
15:41:01grncdre.g. I want some but not all variants to have `name: string`
15:41:58grncdrI guess this is an issue because the field might be at different offsets depending on which variant you have?
15:43:28def-grncdr: now that you say it, that sounds reasonable
15:44:37grncdrstill seems like something the compiler could maybe handle, but I'm happy enough to skip it and use inheritance for now
15:47:42grncdris there a way to associate static data with an object type?
15:51:00grncdrhm, scratch that, seems like I can get what I want with static[T] and typedesc maybe
15:51:07nimnoob123def- alright should be good to go, had to test and clean up some formatting
15:53:21*JinShil joined #nim
15:55:41nimnoob123def- updated the static define's to: SDL_Static, almost forgot
15:56:29*Trustable joined #nim
15:58:41ldleworkI recovered my meta-programming article
16:01:29*JinShil quit (Quit: Konversation terminated!)
16:07:55coffeepothave a good weekend everyone :)
16:08:16*coffeepot left #nim (#nim)
16:09:02*yglukhov_ quit (Quit: Be back later ...)
16:11:04*aboisvert joined #nim
16:16:45*BitPuffin|osx quit (Ping timeout: 265 seconds)
16:20:13*milosn joined #nim
16:21:54*vendethiel quit (Ping timeout: 272 seconds)
16:23:03*banister joined #nim
16:24:55*Ven_ joined #nim
16:26:11*filcuc joined #nim
16:26:25*vendethiel joined #nim
16:35:45def-Huh, what kind of error am I supposed to get with emscripten and Nim's GC?
16:35:55def-Because it seems to compile and run just fine
16:36:16Araqnever tried it myself
16:36:26Araqin theory it can work out of the box
16:36:44Araqdepending on how good emscripten's emulation of a real CPU has become
16:41:43*ingsoc quit (Quit: Leaving.)
16:42:24*Strikecarl joined #nim
16:42:47Strikecarlhow do i execute Powershell commands in nim?
16:43:26AraqStrikecarl: like anything else. osproc or os.execShellCmd
16:44:02Strikecarloh ty
16:48:25*wtw quit (Ping timeout: 264 seconds)
17:02:21*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
17:04:37*Matthias247 joined #nim
17:05:39*Sharcho quit (Ping timeout: 245 seconds)
17:07:42*Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:14:31reactormonkhow can I find the next open port I can listen to?
17:14:47reactormonkjust start opening ports and catch the corresponding exception?
17:14:49ddl_smurftry opening until it works
17:14:59ddl_smurfif not root, start after 1024
17:15:11reactormonkok
17:15:57ddl_smurf(fwiw it drives me nuts when software does that, why not just let the user pick his port)
17:16:19reactormonkddl_smurf, epc works that way
17:16:35ddl_smurfwhat's epc ?
17:17:22reactormonkhttps://github.com/kiwanami/emacs-epc
17:20:47reactormonkhow can I reraise the current exception in an except block?
17:22:08reactormonkhttps://gist.github.com/7f5467e3b41100d07d8f rough sketch o nhow it should look like
17:22:11BlaXpirit_reactormonk, if simply `raise` doesn't work, try raise getcurrentexception
17:22:17BlaXpirit_()
17:22:48reactormonkBlaXpirit_, what would you think of a template `reraise` that does just that?
17:23:14*aboisvert_ joined #nim
17:23:15BlaXpirit_the existence of getCurrentException is already ridiculous to me
17:23:42*aboisvert quit (Ping timeout: 256 seconds)
17:23:42*aboisvert_ is now known as aboisvert
17:23:42BlaXpirit_so minor additions on top of it don't make it better
17:24:14BlaXpirit_well actually getCurrentException is useful but I mean having to use it
17:27:15fowlI agree
17:27:34fowlGetcurrentexceptionmsg is too damn long too
17:27:56*BitPuffin|osx joined #nim
17:32:51grncdrdoes anybody know of a lib for "declarative" (de)serialization of nim objects?
17:35:44*ingsoc joined #nim
17:39:20fowlgrncdr: can you elaborate
17:40:24grncdrI mean I have a few different object types, then I have code that hydrates instances of those types by doing things like `it.some_field = json_obj["OtherField"].str`
17:40:48grncdrthat code is verbose and repetitive, so I'm wondering if somebody has already created macros that will write it for me ;)
17:41:11grncdralso, pretend I wrote "SomeField" in the quotes above, since that's more realistic
17:41:54grncdrI guess what I'm really wondering, is how do people usually deserialize data to/from their nim types?
17:42:03fowlMarshal module
17:42:08grncdrI've only been writing nim for a few hours so I'm probably missing a *lot*
17:42:13grncdroh!
17:42:44grncdrah, but that only works if I control both ends of communication
17:43:12BlaXpirit_grncdr: can you elaborate
17:43:34grncdrI'm consuming JSON data from some other service
17:43:53BlaXpirit_ok, that does explain everything
17:44:19grncdrso I can't assume that things like "the type of this object represented with a property __type__" etc.
17:44:34grncdrI could be wrong, but I'm not seeing that the marshal module is all that flexible
17:44:40BlaXpirit_nah, grncdr, have u actually seen the output of marshal module?
17:44:45grncdrnope
17:44:51BlaXpirit_so try it out
17:44:51grncdrI learned about it 30 seconds ago
17:44:54grncdrok
17:44:55fowlIts not a plug and play thing
17:45:02fowlIt is for serialization
17:45:23fowlLol
17:46:37grncdrok, not sure what the "Lol" is for… look at this page: http://nim-lang.org/0.11.0/marshal.html and tell me where it implies that I can deserialize to anything other than the exact structure I'm receiving…
17:47:26fowlWhat you described, reading json, doing obj.field = js["too"].int is the root of serialization right, this is what any serialization would boil down to
17:47:41grncdranyways, I'm explaining my problem poorly, I'll try stuff out and come back if I have problems
17:47:48*brson joined #nim
17:47:49grncdrthanks
17:47:49fowlMarshal is a good example of generating these building block statements from the structure of an object
17:52:18*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:58:48*BitPuffin|osx quit (Ping timeout: 272 seconds)
18:00:07*vendethiel quit (Ping timeout: 256 seconds)
18:02:59*vendethiel joined #nim
18:03:01*ingsoc quit (Quit: Leaving.)
18:04:46*grncdr quit (Quit: Leaving.)
18:07:10*banister joined #nim
18:07:25*banister quit (Max SendQ exceeded)
18:10:37nimnoob123well I'm off, hopefully my sdl2 PR gets approved so I can play w/ sdl2_mixer this weekend on my other computer(s) (thank god for nimble)
18:10:43*nimnoob123 quit (Quit: Page closed)
18:17:29*filcuc quit (Ping timeout: 276 seconds)
18:18:14*BlaXpirit-UA joined #nim
18:19:12*BlaXpirit_ quit (Ping timeout: 272 seconds)
18:21:28*BlaXpirit-UA quit (Read error: Connection reset by peer)
18:24:37*BlaXpirit-UA joined #nim
18:24:50*vendethiel quit (Ping timeout: 265 seconds)
18:28:39*Trustable_2 joined #nim
18:29:58*BlaXpirit-UA quit (Ping timeout: 272 seconds)
18:30:12*BlaXpirit-UA joined #nim
18:30:43*Trustable quit (Ping timeout: 255 seconds)
18:31:08*vendethiel joined #nim
18:31:56*Trustable_2 quit (Remote host closed the connection)
18:32:36*Trustable joined #nim
18:33:39*yglukhov_ joined #nim
18:34:49*BlaXpirit-UA quit (Ping timeout: 245 seconds)
18:35:50*BlaXpirit-UA joined #nim
18:37:52*yglukhov_ quit (Ping timeout: 252 seconds)
18:38:30*BlaXpirit joined #nim
18:40:21*BlaXpirit-UA quit (Ping timeout: 256 seconds)
18:43:11*BlaXpirit quit (Ping timeout: 256 seconds)
18:43:21*gsingh93 quit (Remote host closed the connection)
18:43:56*BlaXpirit joined #nim
18:48:51def-http://hookrace.net/blog/porting-nes-go-nim/
18:48:51*BlaXpirit quit (Ping timeout: 256 seconds)
18:51:40*HakanD_ joined #nim
18:57:38*boydgreenfield joined #nim
18:59:19*boydgreenfield quit (Quit: boydgreenfield)
19:00:27*yglukhov_ joined #nim
19:03:57def-I hope there's some interesting stuff in there
19:13:23ekarlsois anyone serious using nim atm ?
19:20:07Araqekarlso: yes.
19:20:12ekarlsoAraq: like ? :p
19:20:32Araqus (3dicc).
19:20:58Araqthere are others too.
19:21:39*iamd3vil quit (Ping timeout: 264 seconds)
19:21:51ekarlsoAraq: any network services yet ? :p
19:22:08flaviuYou know, I'd love `except OsError err:`.
19:22:24ekarlsoflaviu: +100
19:22:43Araqflaviu: implement it.
19:22:49flaviuusing getCurrentException is overly verbose for a pattern that should be the recommended way to do things.
19:23:05Araqwhy is it recommended?
19:23:36Araqwhat's the point of the exception type when you then have to go on and grab additional information anyway?
19:23:44flaviuAraq: It's possible to include more information in the error message, sometimes allowing a program to fail more intelligently.
19:24:06flaviuFor example, "SyntaxError" in an sql wrapper could have the line and column as fields.
19:24:22*ekarlso should take a look at play stuff again
19:24:29fowlekarlso, yes fix it please, i miss it
19:24:39ekarlso:p
19:24:41fowler not fix it get it running again
19:24:50def-I'm also still waiting for nim-play
19:25:33Araqflaviu: that doesn't make it "recommended"
19:26:05flaviu"should be the recommended way" :P
19:26:07Araqbut again go ahead and implement it
19:27:01*flaviu quit (Remote host closed the connection)
19:27:31Araqthough I guess the more consistent syntax is except (foo: OsError):
19:27:51*flaviu joined #nim
19:27:58fowlthen other exceptions keep unwinding?
19:28:01def-yes, "except OsError err:" could also be parsed as "except OsError(err):"
19:28:25Araqfowl: just like it is now
19:28:55fowlAraq, oh and foo would be (ref OSError)(getCurrentException()) ?
19:29:03Araqfowl: yes
19:29:16Araqor maybe the syntax should be:
19:29:22Araqexcept OsError as foo:
19:29:24Araq?
19:29:28Araqdunno
19:29:55fowli would expect except(foo: Err):
19:30:25*milosn quit (Ping timeout: 250 seconds)
19:30:28flaviuAraq: I understand where you're coming from, I too have a busy schedule right now.
19:30:57flaviuI might have some free time late next week though, I'll look into it then.
19:32:13flaviubtw, I like def-'s point. "except OsError(err):" might be more consistent if someone decides to create a pattern matching macro.
19:32:32*milosn joined #nim
19:33:52def-flaviu: that wasn't my point. My point was that right now "OsError err" is a type conversion of err to OsError
19:38:31*BlaXpirit joined #nim
19:49:08dom96flaviu: +1. I've wanted this since forever.
19:49:40*gokr_ joined #nim
19:52:40*Sharcho joined #nim
19:56:15HakanD_Porting a NES Emulator from Go to Nim, 2nd on HN front page. I love the attention Nim gets on HN
19:58:12dom96Yeah, def- is doing a really good job promoting Nim.
20:01:10*vendethiel quit (Ping timeout: 255 seconds)
20:02:44HakanD_Now, if only we could get some coverage and end this wikipedia siliness once and for all
20:03:49def-Actually I tried submitting the github site 2 to HN 2 times and no one noticed. I guess they only like blog posts
20:05:00HakanD_You write good blog posts (:
20:05:31def-Thanks
20:07:13Araqdef-: yeah superb work!
20:08:03renesacidea that I gave before: ping suitable news sites about nim release and link that def- blog post too
20:08:18HakanD_I found Nim via HN, and got hooked to it after reading your blog posts
20:08:44renesacand try to prod them to try out nim and write something non-trivial that could be used as wikipedia source
20:09:16renesacand yeah, suberb work def-
20:09:42dom96def-: it's odd, but it seems that Reddit prefers the Github link.
20:10:16def-dom96: Maybe it's because the Github link was upvoted before, or the Go people on Reddit don't like me (no downvote button on HN), or it's just coincidence
20:11:07flaviudef-: Let's stay away from accusing people/groups without strong evidence.
20:11:20def-flaviu: sorry, right. wasn't entirely serious
20:12:11flaviumy bad then, tone is hard to hear over text :)
20:12:27HakanD_don't know about go, but people love to compare Nim with Rust, for one reason or another
20:13:08HakanD_nearly every nim topic includes a rust comparison, and rust people chimming in after
20:13:55flaviuNim and Rust are aiming at a similar audience.
20:17:08*shodan45 quit (Quit: Konversation terminated!)
20:17:27HakanD_anyways, a good day for nim
20:17:31HakanD_gnight everyone
20:17:59*gmpreussner|work joined #nim
20:18:41*HakanD_ quit (Quit: Be back later ...)
20:23:00*gsingh93 joined #nim
20:33:21gmpreussner|workim on a fresh windows box with nim at head @ devel. can't compile c2nim at head: "Error: Cannot open 'compiler/llstream'"
20:33:35gmpreussner|worki think i've seen this before a couple months ago, but can't remember what was wrong/missing
20:33:42gmpreussner|workdoes anyone know?
20:33:45def-nimble install compiler?
20:34:27gmpreussner|worki have nim/bin in my PATH. is that not enough?
20:34:29def-on Linux it gets installed automatically, strange
20:34:55def-When you do "nimble install c2nim" doesn't it get the compiler package first?
20:35:18gmpreussner|worki didnt install via nimble. i grabbed my fork from github
20:35:22gmpreussner|workfor both
20:35:53def-c2nim needs the compiler package, not sure how to do that without nimble
20:36:02gmpreussner|workoh i see
20:36:30gmpreussner|workso the compiler/ folder is not searched automatically?
20:36:58def-not sure
20:41:21gmpreussner|workpassing the path to nim via -p works
20:41:23gmpreussner|workodd
20:41:44Araqgmpreussner|work: my c2nim doesn't have any .nim.cfg either. maybe dom96 removed it?
20:42:11Araqusually there is a config which sets -p:$nim/compiler
20:42:27gmpreussner|workah, that might be it
20:43:01*BitPuffin|osx joined #nim
20:44:04gmpreussner|workthis change maybe: https://github.com/nim-lang/c2nim/commit/f408d1594cf32aef7fe5b225b52104967d435146
20:44:43Araqyeah
20:48:18*flaviu quit (Remote host closed the connection)
20:48:59*TEttinger joined #nim
20:55:34*nimnoob123 joined #nim
20:56:16nimnoob123hey fowl let me know if that syntax change works for you https://github.com/nim-lang/sdl2/pull/41#issuecomment-98192198
20:57:27fowlThanks nimnoob123 I will merge it in a sec
20:57:37fowlLooks fine btw
20:57:44nimnoob123cool, thanks. was fun :)
20:57:49*vendethiel joined #nim
20:58:17dom96gmpreussner|work: You're meant to install it via Nimble
21:01:57*mpthrapp quit (Remote host closed the connection)
21:07:16*aboisvert quit (Ping timeout: 264 seconds)
21:07:20Araqif somebody wants something easy to do
21:08:08Araqadd GCC's builtins to lib/system/arithm.nim to get much more efficient overflow detection
21:08:43*foobar_ joined #nim
21:09:12foobar_Hey, I was wondering about the JS backend. Does it use Emscripten?
21:09:19fowlIs there any way to get the c compiler
21:09:21def-Araq: Ha, I thought about exactly that
21:09:51def-foobar_: No, it's written in Nim directly, but you can use emscripten instead
21:09:55fowlSo I can tell if its GCC of msvc
21:10:09Araqfowl: when defined(gcc) ?
21:10:14Araqwhen defined(vcc) ?
21:10:32fowlThat will work
21:10:33foobar_What's the point of writing it in nim? You can just take the C code and use clang to get LLVM and then compile that with emscripten.
21:10:35Araqfoobar_: no, it doesn't
21:10:56Araqfoobar_: our JS backend predates emscripten
21:11:10foobar_OK
21:11:34foobar_If I use emscripten, should it work out of the box for nim?
21:11:59Araqdef- says it does, filwit says it doesn't.
21:12:22Araqso ... I don't know
21:12:22foobar_hmm
21:12:36def-foobar_: Worked for me here: http://hookrace.net/blog/porting-nes-go-nim/
21:12:45foobar_Oh, you write hookrace?
21:13:09def-Right
21:15:57foobar_def-: What modifications, if any, were necessary for the glory that is http://hookrace.net/nimes/
21:16:05foobar_From the nim source, that is
21:16:10foobar_To get it to compile to working js
21:16:35foobar_Also, how many nim lines?
21:17:14fowlHe used emscripten for that
21:17:46foobar_I know, but are any special libraries or anything necessary to interface to the js stuff?
21:17:52*grncdr joined #nim
21:18:04foobar_I mean, I know its a direct source-to-source compilation, but maybe graphics libs are different?
21:19:17fowlDunno check it out on github, there's another project that compiles to js/android/iOS and it has a lot of custom code for js
21:19:56*vendethiel quit (Ping timeout: 252 seconds)
21:20:16*foobar_ quit (Quit: Page closed)
21:21:02*BlaXpirit quit (Ping timeout: 252 seconds)
21:21:09*BlaXpirit_ joined #nim
21:22:02*grncdr1 joined #nim
21:22:16*grncdr quit (Ping timeout: 256 seconds)
21:23:08def-Oh, I'm too late. It was pretty easy and the article explains it. Basically SDL2 does all the work already
21:24:04fowlDoes sdl2 get compiled when the page is loaded?
21:24:20def-No, it's precompiled
21:24:28*gokr_ quit (Remote host closed the connection)
21:24:30fowlOh
21:24:53def-into a 1 MB JavaScript file: http://hookrace.net/nimes/nimes.js
21:25:46samlwow nim real web scale
21:25:48fowlEmscripten precompiles sdl2 into js? O.o
21:25:55samlhow do I upgrade nimble?
21:26:11fowlNimble install nimble
21:26:13def-fowl: Only the current HG version of sdl2, unreleased so far, but they have excellent emscripten support now
21:26:54samlnimble install nimble fails
21:26:58*gokr_ joined #nim
21:27:36def-saml: then manually from https://github.com/nim-lang/nimble I guess
21:27:53fowlnimble@#head will try live version
21:28:54samlthat worked
21:28:59fowldef-: you said the issue with emscripten is no gc, so you just don't create GC objects after initialization right
21:29:02*yglukhov_ quit (Read error: Connection reset by peer)
21:29:10*yglukhov_ joined #nim
21:29:26def-fowl: I thought that was the problem, so I disabled GC because I realized I don't need it. Later I tested with GC and it seems to work as well
21:29:47def-fowl: I guess someone should test a program that actually allocates some memory
21:31:20Araqyeah, like some GC test ...
21:31:44fowlNes back end for Nim plz
21:33:17BlaXpirit_kek
21:35:25BlaXpirit_guys...
21:35:27*gsingh93 quit (Ping timeout: 256 seconds)
21:35:31BlaXpirit_0.11.0 silently broke docopt.nim
21:35:40BlaXpirit_I have no idea what happened, only half of tests pass now
21:36:01BlaXpirit_most curious thing is, everything was fine on devel 2 weeks ago
21:39:46AraqBlaXpirit_: well report it properly. this time we can do 0.11.2
21:40:02BlaXpirit_i don't know what to report, where to look
21:40:13BlaXpirit_difficult to investigate
21:40:15*Ven_ joined #nim
21:41:39def-BlaXpirit_: bisect the compiler repo
21:41:45BlaXpirit_oh yeah
21:41:51BlaXpirit_there is that
21:43:00*keypusher quit (Quit: Konversation terminated!)
21:43:15*keypusher joined #nim
21:43:34BlaXpirit_def-, how do i tell it where to start from?
21:43:45def-git bisect start
21:43:57def-hm no
21:44:02def-git-bisect good (or bad)
21:44:23BlaXpirit_well is it gonna check until the very beginning?
21:44:33def-I think you have to find a good commit first
21:44:37def-and start from there
21:44:47def-you can use ./koch temp c foo.nim for faster recompilation
21:45:06def-git bisect run ./koch temp c foo.nim
21:45:16Araqit's commit 26eae7d00e73c656 anyway
21:45:44Araqwas a highly risky change to the compiler
21:45:46*saml quit (Quit: Leaving)
21:46:53Araqbut it was so annoying to fix that I couldn't go back
21:47:01BlaXpirit_Araq, commit before it works well
21:47:20Araqyeah I can imagine
21:47:21BlaXpirit_checking the commit itself now...
21:48:00BlaXpirit_Araq, fails
21:48:03BlaXpirit_so what is it?
21:48:14BlaXpirit_https://github.com/Araq/Nim/commit/26eae7d00e73c65670775091bad8bfd796b3e1f1
21:48:16Araqsee? I'm better than git bisect.
21:48:31BlaXpirit_so fast
21:48:35*Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:49:55BlaXpirit_so then, what should i report?
21:50:12Araqsomething thats 1 file without deps and fails
21:50:27Araqcan be a large file, i don't care
21:50:49BlaXpirit_Araq, at least tell me what was changed there!
21:50:53Araqbut it will be another test case, so I don't want dependencies
21:50:56BlaXpirit_it's got to be something about methods
21:51:15AraqBlaXpirit_: how types are computed.
21:51:26Araqusually sets or tuples are affected by this
21:52:20Araqalso note that this patch got rid of a section that reads "# XXX finally rewrite that crap!"
21:52:30Araq:P
21:53:16*Matthias247 quit (Quit: Matthias247)
21:53:39BlaXpirit_no, i'm almost sure it's methods
21:53:58Araqmethods are hardly affected by this patch though
21:54:13Araqbut we'll see
21:54:31BlaXpirit_is there even a basic test for dynamic dispatch in tests?
21:54:44Araqyes. lots of.
21:54:57BlaXpirit_but hmm if basic things failed, even half of tests wouldn't pass
21:55:23thotypousBlaXpirit_: did you test with commit just before that to be sure it is really the culprit?
21:55:39*enquora joined #nim
21:55:43BlaXpirit_thotypous, [:46:59] <BlaXpirit_> Araq, commit before it works well
21:55:51thotypousah sorry didn't read
21:56:49def-Araq: ok, the gctest throws an exception with emscripten
21:58:04reactormonkdef-, got a bit more information?
21:58:14BlaXpirit_gaaah i don't know how to test this
21:58:33def-reactormonk: "Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"
22:01:59*enquora quit (Remote host closed the connection)
22:02:01def-reactormonk: works with markandsweep!
22:02:18*enquora joined #nim
22:03:11def-reactormonk: or not, just runs longer
22:04:08def-i don't know if it's GC specific, fails even with --gc:none
22:05:09*enquora quit (Remote host closed the connection)
22:05:20Araqinteresting
22:05:45def-Maybe it's just allocating lots of memory. I had to manually up the emscripten memory limit a bit for the NES emulator
22:11:16federico3def-: are you the author of what-makes-nim-practical?
22:12:09Araqgood night guys. I won't be here tomorrow, hope you'll manage to survive without me ;-)
22:12:18BlaXpirit_but but nim is broken D:
22:13:11def-federico3: yes
22:13:22federico3def-: very nice article, thank you for this
22:13:39def-Good night Araq
22:13:48def-Thanks federico3, glad that you like it
22:16:00ldleworkwoooo! http://blog.ldlework.com/
22:16:40ldleworkNow, I can blog about nim more.
22:19:17*grncdr1 quit (Quit: Leaving.)
22:19:37def-ldlework: Nice, is that an old article?
22:19:39*X-Scale joined #nim
22:20:48Varriount_ldlework: If only wikipedia viewed you as a 'reliable resource'
22:20:53*Varriount_ is now known as Varriount
22:21:46ldleworkdef-: that's my old article yeah
22:21:54ldleworkdef-: my blog server got pwned and locked down by digital ocean
22:22:07ldleworkso I had to recover, so my publication dates were lost
22:22:59nimnoob123idlework what theme is that?
22:23:31VarriountAraq: tscheduler.nim is hanging on win32
22:25:20*yglukhov_ quit (Quit: Be back later ...)
22:26:10federico3def-: should we distribute nimscript as /usr/bin/nimscript as part of the compliler?
22:29:24def-federico3: I'm not sure. It requires tcc as it is
22:30:26Varriountfederico3, def-: Whats NimScript?
22:31:45def-Varriount: http://hookrace.net/blog/what-makes-nim-practical/#use-as-a-scripting-language
22:32:19BlaXpirit_https://github.com/flaviut/nimrun/blob/master/nimrun
22:32:23BlaXpirit_(see also)
22:33:00VarriountAh, ok
22:34:04*Kingsquee joined #nim
22:35:20nimnoob123damn small world BlaXpirit_ just seen your crystal crsfml project, nice
22:35:30BlaXpirit_uh ok thanks
22:36:35federico3def-: either there could be a nim-tcc-script and nim-gcc-script, or just error out if tcc isnot there
22:37:49BlaXpirit_or try tcc then any compiler
22:38:01federico3I could imagine a nim-script package that depends on tcc
22:38:53federico3autoselecting compilers sounds very risky :)
22:39:45BlaXpirit_well isn't that what nim does
22:40:03BlaXpirit_maybe it doesn't, doesn't matter
22:40:23BlaXpirit_what i mean is try tcc then nim's default
22:40:29onionhammerdef- awesome work on that NES emulator port. very clean :)
22:40:34federico3even if, nim is used by developers, nimscript could be used by unaware users that just run ./foo.nim
22:42:17BlaXpirit_is it possible that seq doesn't have copy semantics anymore?
22:42:37BlaXpirit_this is taking forever to debug
22:42:55def-BlaXpirit_: that would be shocking. i can't believe my tests could've missed that
22:42:56*RaphaelHythloday joined #nim
22:43:54def-BlaXpirit_: just paste all your files into a single file and start removing stuff until it's reasonably small (at least that's what I usually do)
22:44:24BlaXpirit_i always do that
22:44:25def-BlaXpirit_: how's crystal compared to Nim btw?
22:44:28BlaXpirit_but you don't understand
22:44:42BlaXpirit_i can't find where the error is even with the complete thing
22:45:31def-insert debug outputs everywhere and compile with working and non-working compiler to see where the difference happens
22:45:38BlaXpirit_i'm doing exactly that
22:46:37BlaXpirit_how's crystal compared to Nim: it is much closer to what I was seeking in a language
22:46:51BlaXpirit_I want Python but fast. it is Ruby but fast. close enough...
22:47:35federico3uh, nimes is not compiling for me - range is empty at nes/types.nim(59, 30)
22:47:40def-Yeah, Nim isn't exactly "Python but fast", but I like the differences
22:47:49def-federico3: compiler version?
22:48:02federico30.10.2
22:48:06def-That doesn't work
22:48:15def-That's why I waited until 0.11.0 was released
22:48:58BlaXpirit_personally I don't see much use for Nim :(
22:49:15BlaXpirit_I tried to apply it to game dev, it does not fit my needs
22:49:31BlaXpirit_and for the rest i have Python
22:49:35federico3oops, sorry, I missed the line where you mentione dit
22:56:01BlaXpirit_i dont know what's going on
22:56:17BlaXpirit_it's almost like... i'm passing a seq of len 2 and the function sees it at len 0
22:58:23BlaXpirit_so result is a tuple
22:58:25BlaXpirit_result = pattern.match(result.left, result.collected)
22:58:50BlaXpirit_result.left.len == 2 but function match gets result.left.len == 0
22:59:05BlaXpirit_i hope this is it...
23:03:10nimnoob123is nre still the goto over re? wondering if re got updated w/ 0.11.0 - I remember back there was a discussion about fixing it
23:04:01BlaXpirit_re was not updated
23:04:19BlaXpirit_and will not be significantly changed
23:04:42BlaXpirit_might be deprecated though
23:05:18nimnoob123ah, thanks
23:05:36BlaXpirit_aww yiss, i found the bug
23:07:06DSAFDSGFDwhat was it
23:07:31BlaXpirit_result = pattern.match(result.left, result.collected) result gets cleared before it is passed to match
23:11:25*foobar42 joined #nim
23:12:12*RaphaelHythloday quit (Ping timeout: 256 seconds)
23:13:52BlaXpirit_the bug: https://github.com/Araq/Nim/issues/2630
23:13:58*Siecje joined #nim
23:15:45BlaXpirit_this is pretty rare, but just impossible to debug
23:17:33*banister joined #nim
23:19:36*HakanD_ joined #nim
23:21:33SiecjeIs there a template library that plays nice with nim?
23:21:49federico3can I build the entire docs in an epub?
23:22:06BlaXpirit_Siecje, uh sure
23:22:12BlaXpirit_but you gotta be specific
23:22:54SiecjeBlaXpirit_: Templating engine*
23:23:02BlaXpirit_nope
23:23:10BlaXpirit_don't know what you mean
23:23:45*HakanD_ quit (Ping timeout: 244 seconds)
23:25:33SiecjeBlaXpirit_: For example in the Python ecosystem there is Jinja2, mako, Django templates, etc. In JavaScript there is Jade, EJS, skinny, etc
23:25:47BlaXpirit_that's gonna be https://github.com/onionhammer/nim-templates
23:26:02BlaXpirit_or same thing in 30 lines of code xD https://github.com/BlaXpirit/nimception
23:27:24federico3def-: now it's not finding sdl2. I have libsdl2-dev installed.
23:27:42BlaXpirit_but do u have nim package sdl2 installed?
23:27:44def-federico3: not finding the nimble sdl2 package?
23:28:19def-if you build with "nimble build" it should download it automatically
23:28:21federico3aha, I need a Nim sdl2 as well, ok
23:30:08def-Siecje: There's also a templating mechanism built into the Nim compiler, which you can use like this: https://github.com/Araq/Nim/blob/devel/tests/template/sunset.tmpl
23:30:22def-http://nim-lang.org/0.11.0/filters.html
23:30:48BlaXpirit_dang it
23:31:23BlaXpirit_so i reinvented the wheel
23:31:32DSAFDSGFDtheres some sdl2 constant missing in the wrapper
23:31:38DSAFDSGFDconstants*
23:31:40SiecjeHey def- nice blog posts :)
23:31:49BlaXpirit_def-, why didn't nobody tell me that I reinvented "filters" in https://github.com/BlaXpirit/nimception
23:32:19def-BlaXpirit_: From what I remembered Araq showed your filters and you said they weren't powerful enough (but I may be misremembering)
23:32:20BlaXpirit_lol it looks exactly the same
23:32:31federico3uh, there's a bug in nible: https://github.com/nim-lang/packages/raw/master/packages.json is hitting a redirect
23:33:07def-DSAFDSGFD: So it doesn't work? You could make a pull request
23:33:37def-federico3: That may be a bug in Nim 0.10.2
23:34:10DSAFDSGFDdef-: it works, just missing some constants about opengl
23:34:10def-federico3: you could try rebuilding nimble with the new nim
23:34:17DSAFDSGFDSDL_GLprofile enum
23:34:22DSAFDSGFDSDL_GL_CONTEXT_PROFILE_CORE* = cint(0x0001)
23:34:24DSAFDSGFDetc..
23:34:51def-DSAFDSGFD: I think the SDL2 wrapper was hand-written and people just add the things they need, so yeah, some stuff is still missing
23:34:57DSAFDSGFDo ok
23:35:09def-But PRs are always welcome
23:35:24DSAFDSGFDkk i might do that, theres some stuff wrong in the opengl wrapper too
23:35:38DSAFDSGFDpointer with size int32
23:35:47DSAFDSGFDinstead of machine dependant
23:35:58BlaXpirit_def-, are these source code filters built into the compiler?
23:36:01federico3def-: I used 0.11
23:36:12DSAFDSGFDanyway ill look at making some pull request sometimes
23:36:27BlaXpirit_i suppose reinventing them in userland is something...
23:36:56def-BlaXpirit_: I assume so
23:37:11federico3hm, it seems to be working now
23:37:54SiecjeI'm looking for something that can do template inheritance
23:37:58onionhammerSiecje see http://www.eoleary.me/Blog/The-Templates-Library
23:39:41*BlaXpirit-UA joined #nim
23:39:51BlaXpirit-UApretty sure there is no templ. lib with inheritance
23:39:56fowlopengl is a joke atm
23:40:00fowlsomeone messed it up
23:40:53*BlaXpirit_ quit (Ping timeout: 250 seconds)
23:40:58onionhammerSiecje how do you mean inheritance?
23:41:13BlaXpirit-UA:s
23:41:26onionhammerhttps://github.com/onionhammer/samplenimweb
23:41:29onionhammeranother usage
23:41:31Siecjeonionhammer: Have a base template with html boilerplate and have page templates use the boilerplate
23:41:39onionhammeryeah you can do that
23:41:42onionhammerwith nim-templates
23:41:53onionhammerhttps://github.com/onionhammer/samplenimweb/blob/master/master.nim
23:42:20onionhammeryou can do it in a more sophisticted way than that using templates instead of procs
23:42:30onionhammernim-templates only works at compile-time though
23:43:45Siecjeonionhammer: and $content can be another template?
23:45:06onionhammerif its a template it has to be ${ content }
23:45:15onionhammer$content basically means "this variable as a string"
23:45:18BlaXpirit-UASiecje, no inheritance. basically what happens here is the result of rendering one template is passed as a variable to the master template
23:45:30onionhammerno..
23:45:54onionhammernim-templates basically translates the input string into nim code at compile time
23:46:05onionhammerso you can pass in other nim code at compile time
23:46:14onionhammerit doesnt have to be generated string BlaXpirit-UA
23:47:17onionhammeri.e. tmpl html"<div>$var</div>" => result.add("<div>"); result.add(var); result.add("</div>") at compile time
23:47:34BlaXpirit-UAonionhammer, i get it
23:47:55BlaXpirit-UAlike i keep saying, i implemented such templates in 30 lines of code https://github.com/BlaXpirit/nimception https://gist.github.com/7e4a445f5c64ef658d2d
23:47:57onionhammerso if instead of $var you have ${ var } where var is another template, it will do all that work
23:48:32*brson quit (Quit: leaving)
23:50:19Siecjeonionhammer: Thanks for explaining
23:50:20BlaXpirit-UAin your example you're just passing a rendered string to another template... that's what i'm saying
23:50:29onionhammerno
23:50:34SiecjeBlaXpirit-UA: no it gets expanded
23:50:42ldleworkThat's what he's saying
23:50:43onionhammerexactly, it gets expanded
23:50:47ldleworkall it is passing is an expanded template
23:50:48BlaXpirit-UAcontent: string ??
23:51:03onionhammercontent is a template, not a string
23:51:23onionhammeryou're injecting code into it
23:51:28ldleworkThis sounds like composition rather than inheritance
23:51:40BlaXpirit-UAwell of course it is not inheritance
23:51:52ldleworkWell some template systems support inheritance
23:52:02ldleworkIE, explicit overrides of marked blocks
23:52:03Siecje<div>${ var }</div> => result.add("<div>"); result.add("<span>text</span>); result.add("</div>"); => result.add("<div>"); result.add("<span>") result.add("text"); ...
23:52:09onionhammerldlework I asked what was meant by inheritance
23:52:09BlaXpirit-UAbut what are we talking about here... **content: string**
23:52:25ldleworkWhy anyone would want to use a compile-time template engine anyway is strange...(digress)
23:52:39BlaXpirit-UAhttp://jinja.pocoo.org/docs/dev/templates/#template-inheritance
23:52:44ldleworkBlaXpirit-UA: +1
23:52:49onionhammerldlework why wouldnt you?
23:52:55ldleworkonionhammer: because I have runtime data?
23:53:01ldleworkI'm rendering a template in response to?
23:53:13ldleworkLike, 99% of the use-cases of template engines today?
23:53:13onionhammeryou can still use dynamic data in the template
23:53:18onionhammerbut the template itself is static
23:53:31Siecjeonionhammer: Can you explain that
23:53:35ldleworkI guess I haven't looked at nim-templates well enough then
23:53:54BlaXpirit-UAldlework, that's like saying why would i use a compiled programmign language if i have runtime data :p
23:53:54ldleworkWhen I looked at it for the use of generating web-pages I remember feeling dumbfounded
23:54:03onionhammerSiecje ldlework basically it means you have to recompile the program if you change the structure of your html page
23:54:22onionhammerbut you can still display dynamic variables/loop/if/else etc dynamically
23:54:26onionhammerjust like any other nim code
23:54:36onionhammerand it will generate different output, but the template code remains the same
23:55:20ldleworkWhat about dynamically including other templates?
23:55:21onionhammertmpl html"<div>$name</div>" where name <= some user input
23:55:39onionhammersure ldlework, but there you would end up passing in a rendered string
23:55:50*foobar42 quit (Ping timeout: 256 seconds)
23:55:56BlaXpirit-UA[:50:18] <BlaXpirit-UA> in your example you're just passing a rendered string to another template... that's what i'm saying
23:55:58BlaXpirit-UA[:50:27] <onionhammer> no
23:56:03BlaXpirit-UA[:55:38] <onionhammer> sure ldlework, but there you would end up passing in a rendered string
23:56:08BlaXpirit-UAk
23:56:18onionhammerright
23:56:23ldleworklol
23:57:05onionhammeri guess i need to write better examples for it lol
23:57:10onionhammerit's not that inflexible
23:57:29ldleworkWhat's the point in 'compiling' templates?
23:57:46onionhammerso that I can use nim to do all the logic
23:57:48BlaXpirit-UAldlework, the point is it is extremely easy to make templates like that
23:58:02BlaXpirit-UAlet me just spam with https://github.com/BlaXpirit/nimception yet again
23:58:27BlaXpirit-UAtemplating language almost like onionhammer's project IN 30 LINES OF CODE
23:58:47ldlework43 technically
23:59:04BlaXpirit-UAafter 33 is just a demo
23:59:06ldleworkoh that's an example
23:59:09BlaXpirit-UAand there are empty lines
23:59:14fowlcan you use it twice
23:59:14ldleworklol
23:59:30onionhammer<div>$if condition { <div>one thing</div> } else { <div>another</div> }</div>
23:59:33fowlSeems like the compile time function you have to define could only be defined once
23:59:43ldleworkonionhammer: no