00:10:18 | * | gsingh93 quit (Ping timeout: 244 seconds) |
00:12:23 | * | Guest3414 quit (Quit: Page closed) |
00:17:59 | ldlework | def-: you're amazing |
00:18:27 | * | TEttinger joined #nim |
00:25:30 | def- | ldlework: thanks! I hope it works fine on Windows & Mac |
00:28:49 | fowl | ill try it on windows in a bit |
00:29:22 | ldlework | a port of python's urwid module could be nice for nim maybe |
00:32:23 | ldlework | def-: so does your thing not use the js backend? |
00:32:39 | ldlework | or is emscripten Nim's js backend |
00:33:12 | Araq | we haven't got emscripten to work yet |
00:33:36 | ldlework | Araq: it looks like def- has |
00:38:28 | def- | 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:15 | flaviu | re. google indexing the wrong version, perhaps adding a robots.txt blocking everything but `/latest/` might be effective. |
01:10:32 | flaviu | /latest can be symlinked to the latest version of the docs. |
01:14:59 | ddl_smurf | that'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:30 | RaphaelHythloday | Hi, I'm new to nim, and I was wondering about manual memory management. Specifically, the reason |
01:25:30 | RaphaelHythloday | I 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:31 | RaphaelHythloday | will 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:31 | RaphaelHythloday | compile without the GC because parts of the standard module require it. |
01:26:02 | RaphaelHythloday | Oh, 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:42 | fowl | def-, nimes runs fine on windows |
01:40:27 | fowl | RaphaelHythloday, you can change gc settings http://nim-lang.org/gc.html |
01:45:00 | RaphaelHythloday | Another 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:44 | fowl | is that something you can do in rust? |
01:52:05 | fowl | an enum type like U32(u32) | U16(u16) | U8(u8) is possible, but a variable cant change its size |
01:53:40 | RaphaelHythloday | no it's size is fixed but determined at runtime initialization. |
01:53:41 | ddl_smurf | (it also would be either very slow, or it wouldn't actually spare memory) |
01:54:34 | RaphaelHythloday | I mean it would be something like var x = if n < 256: elif n < 65536: uint16 else uint32 |
01:54:44 | RaphaelHythloday | Except that would be wrapped in a type so that would be in the constructor for that type |
01:54:51 | ddl_smurf | but why ? |
01:54:57 | fowl | got an example of this in rust? |
01:55:03 | RaphaelHythloday | No, I've never used rust |
01:55:06 | fowl | it sounds nonsensical |
01:55:16 | fowl | oh |
01:55:17 | ddl_smurf | it does - sorry |
01:55:31 | ddl_smurf | (except for serialisation perhaps, but your variable doesn't matter) |
01:55:42 | RaphaelHythloday | No, 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:58 | RaphaelHythloday | If I use a uint8 instead of a uint32 I use 4 times less memory |
01:56:04 | ddl_smurf | not necessarily |
01:56:12 | ddl_smurf | (probably not actually) |
01:56:23 | ddl_smurf | computers are very good at a certain size of int |
01:56:30 | RaphaelHythloday | I'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:34 | ddl_smurf | that's why they say this chip is 32bit or that one is 64bit |
01:57:05 | fowl | RaphaelHythloday, 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:13 | ddl_smurf | the compiler will help you by aligning (see also packing) your uint8 |
01:57:57 | RaphaelHythloday | Exactly, but it can't pack in 4 literals into one 32-bit word if each literal takes up 32 bits |
01:58:14 | RaphaelHythloday | I 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:19 | ddl_smurf | the compiler will probably reserve 4 bytes and only use one for your uint8 |
01:58:34 | RaphaelHythloday | Then what's the point of the other int sizes? |
01:58:55 | ddl_smurf | platforms, history, people who know how to tell the compiler how to pack |
01:59:08 | RaphaelHythloday | Well why can't nim tell it to pack? |
01:59:27 | RaphaelHythloday | Plus 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:34 | ddl_smurf | probably can, but you really probably don't want |
01:59:37 | RaphaelHythloday | Not saying I like java, I'm saying if java can do it why can't nim? |
01:59:49 | ddl_smurf | java has no shame being slow |
02:00:12 | RaphaelHythloday | how would that slow anything |
02:00:16 | fowl | java runs in a virtual machine |
02:00:29 | RaphaelHythloday | plus you can do the same thing in c++ or whatever any language that has constructors for types/objects |
02:00:41 | ddl_smurf | did you actually measure that java only used the specified byte size for your ints ? |
02:00:49 | RaphaelHythloday | I didn't implement it |
02:00:54 | RaphaelHythloday | I haven't used java in a while |
02:01:02 | ddl_smurf | so why assume it doesn't align too ? |
02:01:17 | Jehan_ | Not sure where Java allows that, unless you're talking about runtime code generation. |
02:01:35 | ddl_smurf | or byte[] |
02:01:44 | RaphaelHythloday | I 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:11 | Jehan_ | 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:25 | ddl_smurf | no 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:26 | Jehan_ | But to specify it at runtime requires that there's code for each variant. |
02:02:32 | RaphaelHythloday | So 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:54 | ddl_smurf | yeah store as a string |
02:03:10 | Jehan_ | Are you looking at an array of ints or just individual variables within an object? |
02:03:17 | RaphaelHythloday | Why 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:20 | RaphaelHythloday | thinking |
02:03:29 | ddl_smurf | or handle the memory yourself (like byte[] and some ops) |
02:03:45 | Jehan_ | The constructor for this new object would have to have code for each different type of int size. |
02:04:02 | RaphaelHythloday | Yes, I know, it would have a switch with five options: uint8 ... 16 and bigint |
02:04:10 | RaphaelHythloday | the switch would be based on size |
02:04:12 | RaphaelHythloday | is this possible> |
02:04:13 | RaphaelHythloday | ? |
02:04:22 | Jehan_ | 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:45 | ddl_smurf | seriously, 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:48 | RaphaelHythloday | Can I just create a type without going into OOP stuff? |
02:05:03 | ddl_smurf | but having them all supported at runtime is wastefull and wont be nearly as optimised as you think |
02:05:23 | RaphaelHythloday | The only waste would be in the constructor code for the type, no? |
02:05:31 | ddl_smurf | no |
02:05:40 | fowl | no it would be at every point you access the data |
02:05:44 | Jehan_ | RaphaelHythloday: No. Any code that accesses the data would have to be replicated. |
02:05:58 | Jehan_ | This is because you need different machine code for each version. |
02:06:02 | RaphaelHythloday | why |
02:06:03 | RaphaelHythloday | oh |
02:06:11 | RaphaelHythloday | so the nim wouldn't be duplicated, but the machine code would be |
02:06:11 | RaphaelHythloday | ok |
02:06:23 | Jehan_ | Yes. |
02:06:36 | ddl_smurf | another way to put it is that your switch/case thing will cost more than what you spared |
02:06:59 | RaphaelHythloday | I guess I'll just use uint32, there's no sat formula imaginable with more than 2^32 literals |
02:07:09 | Jehan_ | ddl_smurf: Well, it may save memory and create better cache behavior for large data. |
02:07:19 | ddl_smurf | (assuming you spare anything, which frankly below int32 is unlikely to be what you want, exceptions would include things like arduinos) |
02:07:34 | RaphaelHythloday | If I'm on a 64 bit machine, will the compiler pack two uint32's into each word? |
02:07:51 | ddl_smurf | sometimes - just trust the compiler to know your machine better |
02:07:57 | Jehan_ | RaphaelHythloday: Generally, yes. Assuming the object layout permits it. |
02:08:06 | RaphaelHythloday | How do I write code to ensure it's permitted? |
02:08:35 | Jehan_ | Generally, keep shorter int variables adjacent to each other. |
02:08:38 | ddl_smurf | you can't garantee it wihtout going to assembler |
02:08:47 | RaphaelHythloday | If they're in a set, will they pack? |
02:09:03 | ddl_smurf | it might be that the compiler picks one of the ints and two other booleans from elsewhere, the compiler is good |
02:09:18 | RaphaelHythloday | Ok |
02:09:31 | ddl_smurf | trust in the compiler, not nimrod, but the gcc =) |
02:09:44 | ddl_smurf | (joke - mostly) |
02:09:58 | RaphaelHythloday | Now 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:04 | ddl_smurf | if may permit a suggestion for your approach to dev |
02:10:09 | RaphaelHythloday | sure |
02:10:23 | ddl_smurf | i admire strongly your pursuit of optimisation, in fact i asked the same question as you not 2 hours earlier |
02:10:43 | ddl_smurf | but get it to work in the most obvious way first, then go on to making it faster |
02:11:05 | ddl_smurf | these 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:13 | Jehan_ | There is an intsets module that is reasonably memory-efficient for sparse sets of integers, as I recall. |
02:11:15 | RaphaelHythloday | I 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:15 | ddl_smurf | you gotta measure, and for that you need working code |
02:12:30 | ddl_smurf | yeah 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:49 | RaphaelHythloday | And Jehan_, thanks intsets sounds good |
02:13:33 | ddl_smurf | chances 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:40 | RaphaelHythloday | Anyway, once nim reaches 1.0 will it be effective enough to produce useful, reliable applications? cli ones at least |
02:14:03 | RaphaelHythloday | And everyone else is using c or c++, but it's mostly about comparing algorithms because everyone uses their own algorithm |
02:14:10 | ddl_smurf | it is quite reliable now already, some crazy people have written NES emulators apparently |
02:14:37 | RaphaelHythloday | My main problem is the ecosystem, I worry that the std lib doesn't have enough stuff |
02:14:56 | Jehan_ | RaphaelHythloday: I'm using Nim already to produce useful, reliable CLI applications. |
02:15:24 | Jehan_ | The main issue for the near future will be library support, not the expressiveness of the language. |
02:15:38 | Jehan_ | (Though there are some language improvements that I hope to see, anyway.) |
02:15:46 | RaphaelHythloday | If I port a std lib module from the python library to nim, will it be included? |
02:15:54 | Jehan_ | Eh, or the implementation of the compiler, for that matter. |
02:15:56 | fowl | Std lib used to be bigger, we made it smaller |
02:15:58 | RaphaelHythloday | Supposing I do a good job, I might do it for some functionality I miss from python |
02:16:02 | RaphaelHythloday | why smaller? |
02:16:06 | fowl | We have a package manager... |
02:16:10 | Jehan_ | RaphaelHythloday: Depends on the quality of the port, and how central it is for Nim. |
02:16:26 | ddl_smurf | you don't need to be in the stdlib to contribute to the ecosystem |
02:16:35 | RaphaelHythloday | Where is the repository for the package manager? |
02:17:04 | Jehan_ | 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:06 | ddl_smurf | traditionally 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:30 | RaphaelHythloday | I agree with you, I have like 100GB on my laptop, why should I be picky about putting packages on it? |
02:17:35 | Jehan_ | RaphaelHythloday: https://github.com/nim-lang/packages |
02:17:43 | RaphaelHythloday | The only problem is that when you compile standard.nim it can take a long time if the std lib is huge |
02:17:52 | RaphaelHythloday | so that's an argument for making it small |
02:18:05 | Jehan_ | RaphaelHythloday: Not really, it compiles only the modules that are imported. |
02:18:06 | ddl_smurf | there's that, and there's what you want included in your compilations |
02:18:14 | Jehan_ | Only system.nim is imported by default. |
02:18:28 | RaphaelHythloday | sorry, system.nim |
02:18:41 | ddl_smurf | *my bad, Jehan_ is right |
02:20:01 | RaphaelHythloday | Can 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:33 | ddl_smurf | i like the kid =) |
02:20:41 | ddl_smurf | good question ? |
02:20:47 | RaphaelHythloday | Ya, I'm in high school sorry if I'm a noob |
02:21:10 | ddl_smurf | still its a good question, i'd like the answer too, if its based on what i know its no |
02:21:25 | RaphaelHythloday | I 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:39 | fowl | You have to write very complicated macros before you start to slow down compilation |
02:21:48 | RaphaelHythloday | I 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:58 | ddl_smurf | it is c |
02:22:34 | RaphaelHythloday | it looks like python with lisp to me, I don't see the c poking through at all |
02:23:00 | RaphaelHythloday | Oh, here's another question: how do I make a script to automatically update nim for me from github? (stable version) |
02:23:01 | ddl_smurf | you will |
02:23:07 | Jehan_ | 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:10 | ddl_smurf | (you already did when you talked about int size) |
02:23:19 | Jehan_ | This is also why interop via importc is pretty easy. |
02:23:32 | RaphaelHythloday | Ya, why does the std lib matter if you can import glibc? |
02:23:58 | ddl_smurf | glibc refused our proposals to rewrite in nim and have nim interfaces |
02:24:19 | RaphaelHythloday | Not rewrite, just wrap |
02:24:35 | ddl_smurf | that is mostly what the stdlib does |
02:24:40 | RaphaelHythloday | I mean, it's supposed to be easy to use c libs |
02:24:44 | RaphaelHythloday | why can't i do cimport glibc |
02:24:45 | RaphaelHythloday | ? |
02:24:49 | ddl_smurf | with some sprinklings of magic so you never have to see strcat again |
02:25:01 | RaphaelHythloday | Never saw it to start out with, I'm a different generation |
02:25:04 | ddl_smurf | you can |
02:25:54 | RaphaelHythloday | How many people do you think use nim but haven't contributed? That is, how many users who aren't also the creators? |
02:26:06 | ddl_smurf | glibc 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:29 | RaphaelHythloday | Well, I mean let's say can I import boost if I compile with c++ as a backend? |
02:27:20 | ddl_smurf | you'd need a lot of very delicate wrapping code |
02:27:35 | ddl_smurf | (that i don't think cimport will help you with, not in c++) |
02:27:49 | ddl_smurf | but ultimately i'd venture its not impossible |
02:28:05 | fowl | C++ support is better |
02:28:15 | RaphaelHythloday | If nim becomes widely popular, will people write a compiler that directly compiles nim to machine code like gcc? |
02:28:24 | fowl | See the project urhonimo |
02:28:34 | ddl_smurf | but at that point you're probably better off just working in c++ or including nim into your c++ objects |
02:29:01 | fowl | And someone was working on a native code generator |
02:29:05 | ddl_smurf | fowl: you want to recommend he try and import boost ? |
02:29:23 | RaphaelHythloday | I heard a lot of bad things about boost btw |
02:29:30 | ddl_smurf | i mean if anything tests your c++ parser, boost will be it |
02:29:35 | RaphaelHythloday | and about c++ generall |
02:29:42 | fowl | No boost is a hairy mess |
02:29:49 | fowl | It scares me |
02:29:53 | ddl_smurf | make your own mind up |
02:30:01 | ddl_smurf | it suits you or not |
02:30:13 | ddl_smurf | they are tools, they are suited to purposes, they are not generally good or bad |
02:30:18 | * | Helios__ joined #nim |
02:30:34 | RaphaelHythloday | How 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:39 | ddl_smurf | (I rather like Boost, which also, should scare you) |
02:30:54 | fowl | I have my own std lib BTW it has modules mostly related to game dev |
02:31:06 | ddl_smurf | can i look ? |
02:31:11 | RaphaelHythloday | fowl are they on nimble? |
02:31:31 | fowl | Github.com/fowlmouth/nimlibs |
02:32:00 | ddl_smurf | http://www.reddit.com/r/nim wow 500 isn't half bad |
02:32:10 | Jehan_ | RaphaelHythloday: There's lots of parallel stuff that isn't very GPU-friendly, actually. |
02:32:32 | RaphaelHythloday | I've built stuff on CUDA before. When I talk parallel I mean a giant reduce/scan/filter type operation |
02:32:55 | fowl | There's a cool project called nimx compiles to android iOS desktop or js |
02:33:16 | ddl_smurf | Copyright (c) 2012 fowlmouth <-- lol i'm not sure how legally binding that will be =) |
02:33:55 | fowl | Its not meant to be legally binding |
02:35:40 | ddl_smurf | that still uses quite a bit of the stdlib, but its a nice assortment, thx a lot =) |
02:38:13 | fowl | Nims new macros.getType() is the best new feature in 0.11.0 |
02:38:40 | RaphaelHythloday | What are the advantages of nim over rust? |
02:38:43 | * | darkf_ joined #nim |
02:38:58 | * | darkf quit (Ping timeout: 265 seconds) |
02:39:22 | ddl_smurf | macros were really buggy last time i tried (like years ago), i think i definitely have to get back on |
02:40:07 | ddl_smurf | rusts' ownership model bugs the fuck out of me |
02:40:20 | ddl_smurf | i love the concept, but in practice its a major PIA |
02:40:46 | fowl | Metaprogramming |
02:41:12 | ddl_smurf | YMMV, the strengths are different, they are both tools better suited at different stuff |
02:41:38 | ddl_smurf | but yeah the macros are awesome, though if that's what you like, racket would be better for instance |
02:41:43 | fowl | And the GC is not to be feared, you should try to stress it out, the "ceiling" is much higher than python |
02:42:29 | ddl_smurf | most 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:15 | RaphaelHythloday | How 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:40 | ddl_smurf | since the language is more complicated |
02:43:53 | ddl_smurf | the macro's code that transforms said language is that much more complicated |
02:43:57 | fowl | In Nim macros you directly build ast |
02:44:11 | ddl_smurf | (instead of symbol literal and list you get ifs and whens and stuff) |
02:44:20 | fowl | Templates are simpler substitution mechanisms |
02:44:32 | RaphaelHythloday | But nim and lisp macros are equally powerful? |
02:44:39 | ddl_smurf | (to be fair in lisp, lisp and the ast are one) |
02:44:57 | ddl_smurf | but macros in lisp still have runtime cost, because lisp isn't compiled into c |
02:45:19 | RaphaelHythloday | Well, it's compiled into lisp bytecode and the macros are expanded at compile-time |
02:45:20 | ddl_smurf | the c code you generate contains the resolution of executing your macros |
02:46:04 | ddl_smurf | well 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:22 | ddl_smurf | "equally powerful" is ill defined, lisp may be more elegant/minimalistic, nim may be more expressive/short |
02:48:51 | ddl_smurf | but if both compilers are working correctly, both macro systems are turing complete |
02:49:16 | RaphaelHythloday | Does nim have map-in-place? That is, map(func,seq) but it modifies seq in place. |
02:49:21 | * | xtagon joined #nim |
02:49:23 | RaphaelHythloday | I can't find it |
02:49:44 | fowl | Its called map |
02:50:00 | fowl | It takes a diff function type |
02:50:26 | RaphaelHythloday | So then what function map's and returns a new seq? |
02:50:59 | fowl | The 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:31 | fowl | There is the chance to change type here |
02:52:00 | fowl | Mutate in place is proc(var a) |
02:52:08 | RaphaelHythloday | Oh, I found it, it's in system |
02:52:12 | RaphaelHythloday | Does nim have scan? |
02:52:25 | ddl_smurf | scanf ? |
02:52:35 | ddl_smurf | https://github.com/fowlmouth/nimlibs/blob/master/fowltek%2Fparsetools%2Fg_lex.nim ? |
02:53:03 | fowl | No that's old and I'm going to delete it asap |
02:53:45 | ddl_smurf | was wondering about the g_* =) |
02:53:49 | fowl | Its probably worthless :p I have a newer parsing lib that let's you build ast directly |
02:54:35 | ddl_smurf | you merged the lexer parser and builder ? |
02:54:55 | RaphaelHythloday | No, scan is like filter and reduce, it's a primitive |
02:55:09 | RaphaelHythloday | I used it a lot in CUDA, it's in all the libs and stuff |
02:55:18 | ddl_smurf | in what lang ? |
02:55:26 | RaphaelHythloday | CUDA is nvidia's gpu extension to C |
02:55:45 | fowl | Raphael sequtils maybe |
02:55:48 | ddl_smurf | we're outside of my competence |
02:56:03 | RaphaelHythloday | It's only useful for parallel computing, basically scan(+, [1,2,3,4,5]) = [1,3,6,10,15] |
02:56:14 | flaviu | "map"? |
02:56:25 | flaviu | oh, I see. Nm. |
02:56:29 | ddl_smurf | map and a closure;ll do ya |
02:57:08 | flaviu | Or a fold will also work if you want to be fancy. |
02:58:08 | RaphaelHythloday | Yes, the fold is the same thing |
02:58:21 | * | saml_ quit (Remote host closed the connection) |
02:58:26 | RaphaelHythloday | Though someone should implement the parallel algorithm for it for the std lib |
02:58:31 | fowl | RaphaelHythloday: Araq would welcome any GPU programming contributions to the std lib |
02:58:33 | ddl_smurf | it'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:08 | fowl | I say that faithfully in a logged channel |
02:59:52 | fowl | There is an opencl target that might need some love |
02:59:59 | RaphaelHythloday | Well, 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:01 | flaviu | wrt. adding it to the stdlib, that's a poor idea. Stdlib needs polish, not new toys. |
03:00:45 | ddl_smurf | gpu is leaving the toy world, sure could use some if it weren't such an annoyance |
03:01:19 | RaphaelHythloday | Why can't nim automatically do parallel stuff on the cpu whenever possible? |
03:01:28 | ddl_smurf | anything that is good on gpu would also be good for the whole multicore trend thing too no ? |
03:01:33 | RaphaelHythloday | yes |
03:01:43 | RaphaelHythloday | 8 core cpu = perhaps 10 core gpu |
03:01:53 | RaphaelHythloday | because gpu cores are really weak, but there are many of them |
03:02:04 | flaviu | ddl_smurf: I'm not against the GPU aspect, I'm against haphazardly adding things to the stdlib without a clear design. |
03:02:05 | ddl_smurf | oh i've written shaders, just not cuda |
03:02:11 | RaphaelHythloday | most graphics cards have like 12 or 16 cores |
03:02:12 | Jehan_ | ddl_smurf: Really depends on your problem domain. |
03:02:47 | ddl_smurf | flaviu: yeah, but is there a clear design ? |
03:02:58 | ddl_smurf | Jehan_: obviously, but so does sequtils |
03:03:04 | RaphaelHythloday | My 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:10 | Jehan_ | sequtils is pretty general. |
03:03:13 | ddl_smurf | besides if the compiler indeed doesn't look an non imported stuff, its free |
03:03:32 | Jehan_ | RaphaelHythloday: Umm. First of all, because it may be slower. |
03:03:44 | Jehan_ | Second, because you may not want to actually use more cores. |
03:04:01 | Jehan_ | Because, say, if you do it to much, your UI grinds to a halt. |
03:04:03 | ddl_smurf | RaphaelHythloday: they could, but nim is still a bit young with regards to threading and doesn't have a dispatch system |
03:04:05 | Jehan_ | too* |
03:04:09 | RaphaelHythloday | Optionall, though. There would be an extra argument to map, reduce, etc like map(stuff, numthreads = 0) and you can change numthreads |
03:04:25 | flaviu | ddl_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:33 | Jehan_ | RaphaelHythloday: You don't want to make that part of the standard map() implementation but a separate module. |
03:05:06 | RaphaelHythloday | The program that I want to make this summer requires parallelism, though. Is nim not mature for that yet? |
03:05:08 | Jehan_ | 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:14 | ddl_smurf | flaviu: 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:14 | RaphaelHythloday | ya, like pmap or preduce |
03:05:51 | flaviu | ddl_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:04 | Jehan_ | 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:26 | RaphaelHythloday | Say I just need to spawn 64 threads that don't communicate. Will that be hard? |
03:06:31 | Jehan_ | others mean* |
03:06:40 | Jehan_ | RaphaelHythloday: That should be pretty easy. |
03:06:46 | ddl_smurf | flaviu: 'm just saying that if the only criterion is consistency/generality than its receeding |
03:06:51 | RaphaelHythloday | Will it be as efficient as openMP? |
03:06:53 | Jehan_ | What's hard is sharing reference-heavy data structures. |
03:07:12 | Jehan_ | openMP isn't particularly magical. |
03:07:13 | RaphaelHythloday | My program just needs to make as many threads as cores to max out the cpu |
03:07:15 | flaviu | ddl_smurf: I don't understand your statement. |
03:07:26 | RaphaelHythloday | And then each thread works on its own |
03:07:31 | Jehan_ | RaphaelHythloday: Yeah, that should be pretty straightforward. |
03:07:35 | RaphaelHythloday | Great |
03:07:40 | RaphaelHythloday | How is that implemented? pthreads? |
03:07:45 | Jehan_ | As I said, it's sharing complicated data structures that's non-trivial. |
03:07:53 | Jehan_ | Yes, on Posix systems, it's pthreads. |
03:08:29 | RaphaelHythloday | Cool. 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:59 | flaviu | Unfortunately, I'm going to have to say goodbye too. night all. |
03:10:07 | ddl_smurf | flaviu: 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:09 | fowl | gn flaviu |
03:10:16 | ddl_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:04 | reactormonk | pigmej, 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:52 | HakanD___ | 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:16 | iamd3vil | Can 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:36 | HakanD___ | iamd3vil: have you seen http://forum.nim-lang.org/t/1164 ? |
08:31:19 | * | HakanD___ is now known as HakanD |
08:35:22 | coffeepot | btw, 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:19 | Araq | coffeepot: exactly |
09:46:32 | coffeepot | are globals simply slower because they can't be optimised to stack? Just guessing :) |
09:47:09 | Araq | the compiler cannot optimize globals well |
09:47:14 | coffeepot | btw finally getting connections to sql server working in nim, yay! |
09:47:32 | coffeepot | Araq, ok that makes sense |
09:47:38 | Araq | cool, make it a nimble package please |
09:48:46 | coffeepot | will 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:26 | repax | coffeepot: A frequently read global is a sure way to blow the cache. Consider passing the value to the proc. |
09:55:07 | coffeepot | repax 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:45 | coffeepot | on 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:11 | novist | gokr: 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:46 | Sharcho | iamd3vil: 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:02 | def- | 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:57 | Sharcho | def-: 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:57 | Strikecarl | How do i get the lowest number (int) in an openArray? |
12:15:39 | Araq | min |
12:16:06 | Strikecarl | what lib? |
12:16:12 | Strikecarl | is it in core? |
12:16:22 | Araq | system.min |
12:16:29 | Strikecarl | ty |
12:18:07 | * | iamd3vil joined #nim |
12:20:05 | Strikecarl | this might sound a bit stupid |
12:20:06 | Strikecarl | but |
12:20:21 | Strikecarl | "e:\nim\nim.nim(3, 11) Error: expression 'lowest(kek)' has no type (or is ambiguous)" |
12:20:31 | Strikecarl | proc lowest*(x: openArray[int]) = echo min(x) |
12:20:41 | Strikecarl | Can anyone hint me what i did wrong |
12:20:44 | Strikecarl | do i have to do like |
12:20:46 | def- | you're not returning the result |
12:20:48 | Strikecarl | (x: openArray) |
12:21:13 | Strikecarl | FUCK nvm |
12:21:16 | Strikecarl | forget what i said (facepalm) |
12:21:30 | Strikecarl | Protip: don't use 2 "echo"'s lol |
12:25:06 | Strikecarl | How 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:44 | def- | Strikecarl: easier to work with seqs then, I think |
12:26:19 | Strikecarl | I'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:38 | novist | in 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:10 | def- | novist: var ss: someObj? |
12:48:32 | def- | Everything is initialized to zero by default in Nim |
12:49:22 | novist | oh damn nice, thanks |
12:50:03 | def- | 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:35 | flyx | when 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:24 | def- | 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:45 | flyx | immediate is deprecated, isn't it |
13:11:22 | def- | Haven't heard of that |
13:11:41 | BlaXpirit_ | i did hear of that, and it made no sense to me |
13:11:53 | BlaXpirit_ | seeing as most of my macros are immediate |
13:11:55 | flyx | I can not use iti at compileTime without the pragma, because I use NimNode in there, which is only available at compile time |
13:12:04 | BlaXpirit_ | flyx, but it's fine |
13:12:15 | BlaXpirit_ | you should just put the code that calls the macro inside static: |
13:12:44 | flyx | the code that calls the macro is in another macro |
13:12:50 | flyx | that's not the problem |
13:13:04 | BlaXpirit_ | make every macro immediate, i dunno |
13:13:26 | BlaXpirit_ | let's not care about some secretive deprecation |
13:13:28 | BlaXpirit_ | for now |
13:13:56 | * | iamd3vil quit (Ping timeout: 246 seconds) |
13:13:57 | * | filcuc quit (Ping timeout: 256 seconds) |
13:14:24 | Araq | flyx: report it |
13:14:30 | flyx | Araq: I will |
13:15:03 | Araq | and fyi 'immediate' will be deprecated once the alternative mechanisms are refined |
13:15:20 | Araq | and it'll be available for months anyway |
13:15:31 | Araq | if not years, we have lots of code that uses it |
13:19:24 | flyx | hmm, it works when I create a minimal example. seems like I have to dig deeper to find the issue |
13:33:30 | flyx | ah okay, it doesn't work because it's an iterator |
13:33:46 | flyx | is that intended or a missing feature? |
13:34:50 | Araq | a compile-time iterator? |
13:35:07 | flyx | yes. I don't need it at runtime |
13:35:19 | Araq | it has no runtime representation anyway |
13:35:27 | Araq | so there is no need for it |
13:35:42 | Araq | unless you mean a closure iterator |
13:35:43 | flyx | ah okay, then the pragma is simply unnecessary |
13:35:55 | Araq | but these don't work at compile-time yet |
13:36:32 | flyx | it's not a closure iterator |
13:36:39 | Araq | very well then |
13:36:54 | flyx | everything 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:46 | gokr | novist: 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:45 | gokr | def-: That's cool stuff :) |
14:28:47 | * | Strikecarl joined #nim |
14:28:48 | Strikecarl | wut, is this a bug? |
14:28:50 | Strikecarl | source: http://pastebin.com/raw.php?i=LdJGR1st |
14:28:53 | * | Matthias247 quit (Read error: Connection reset by peer) |
14:28:54 | Strikecarl | when i run |
14:29:00 | Strikecarl | it returns 7 |
14:29:07 | Strikecarl | logic? |
14:30:06 | * | yymoto2 joined #nim |
14:31:29 | def- | Strikecarl: high is not max |
14:31:39 | def- | high is the highest index |
14:31:48 | Strikecarl | So like, 55 is less than 9? |
14:31:49 | def- | len-1 |
14:32:09 | def- | Strikecarl: high does NOT calculate the maximum, it returns len-1 |
14:32:22 | def- | What you want is max() |
14:32:44 | Strikecarl | oh lol |
14:32:48 | Strikecarl | luv u |
14:32:48 | Strikecarl | c: |
14:33:16 | def- | gokr: thanks! |
14:33:42 | gokr | def-: 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:03 | BlaXpirit_ | what |
14:34:23 | nimnoob123 | im so happy, thanks def- for that link you posted on reddit regarding c2nim |
14:34:39 | nimnoob123 | I gave up on gorillaAudio, but I did manage to get sdl2_mixer working |
14:35:21 | gokr | BlaXpirit_: https://github.com/def-/nimes |
14:35:22 | def- | gokr: At the start I wrote a lot myself. Later I mainly ported the Go code |
14:37:37 | gokr | How does it compare to the Go version? I mean, any specific advantages here with Nim? |
14:38:07 | Strikecarl | How to calculate PI at compile? |
14:38:16 | def- | gokr: performance is better without changing anything, it compiles to JS with emscripten and Android |
14:38:35 | gokr | Yeah, those I kinda suspected ought to be advantages. |
14:38:58 | gokr | Again, going via C/C++ has its nice advantages. |
14:39:10 | gokr | Will you blog about it? |
14:40:05 | def- | 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:29 | gokr | Its interesting as a use case - since we can compare with the Go version. |
14:42:48 | * | yymoto2 quit (Quit: Lost terminal) |
14:42:59 | def- | Compile time is also similar to the Go version |
14:43:15 | gokr | That's quite cool - since Go is famous for that. |
14:45:53 | * | jholland joined #nim |
14:46:04 | coffeepot | is it common for the c cache files to get corrupted? |
14:46:17 | def- | coffeepot: sometimes happens, but i could never reproduce |
14:46:36 | coffeepot | yeah i was coding away and suddenly this: |
14:46:37 | coffeepot | C:\Nim\lib/nimbase.h:393:13: error: size of array 'assert_numbits' is negative |
14:46:37 | coffeepot | typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1]; |
14:46:37 | coffeepot | ^ |
14:46:37 | coffeepot | c:\nimproj\odbc\nimcache\odbc.c: In function 'performquery_105552': |
14:46:37 | coffeepot | c:\nimproj\odbc\nimcache\odbc.c:1235:95: error: expected expression before '?' token |
14:46:38 | coffeepot | printf("%s%s\015\012", ((NimStringDesc*) &TMP231)? (((NimStringDesc*) &TMP231))->data:"nil", ? ()->data:"nil"); |
14:46:52 | def- | that sounds like 64/32 bit problem |
14:47:28 | coffeepot | that's weird, i've been doing this all day and it just suddenly happened on a compile |
14:47:43 | coffeepot | i'm on 64 bit pc, got 64 bit nim 0.11 |
14:47:56 | def- | you didn't throw in a --cpu:i386? |
14:48:32 | coffeepot | nooooo, didn't even know of such a thing |
14:48:52 | coffeepot | interestingly sublime gives a slightly different message (previous was aporia): |
14:48:53 | coffeepot | c:\nimproj\odbc\nimcache\odbc.c: In function 'performquery_105552': |
14:48:54 | coffeepot | c:\nimproj\odbc\nimcache\odbc.c:1235:95: error: expected expression before '?' token |
14:48:54 | coffeepot | printf("%s%s\015\012", ((NimStringDesc*) &TMP231)? (((NimStringDesc*) &TMP231))->data:"nil", ? ()->data:"nil"); |
14:49:09 | ddl_smurf | (that is definitely a C compiler-time pointer width assertion) |
14:50:12 | gokr | That last part looks like incomplete code - so bug in Nim compiler? |
14:50:29 | ddl_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:02 | def- | gokr: ah, and the resulting binary is 191 KB vs 16 MB for Go |
14:51:12 | gokr | But... ? ()->data:"nil" ... looks incomplete. |
14:51:14 | coffeepot | weird. It happens when I removed an echo statement o_O |
14:51:31 | ddl_smurf | gokr: definitely, but with a compiler throwing earlier, better sort out in order |
14:51:55 | gokr | ah |
14:52:28 | Araq | it's not incomplete but there is a ',' too much |
14:52:43 | Araq | maybe a glitch in the 'echo' codegen part |
14:52:59 | gokr | But... there are two %s%s - so ... ? |
14:53:24 | Araq | hrm true |
14:53:55 | def- | gokr: hm, maybe I should write an article about it after all |
14:54:20 | ddl_smurf | i 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:03 | coffeepot | i'll try and cobble together the fragment where it happened... |
14:56:11 | * | HakanD_ joined #nim |
14:57:58 | * | iamd3vil joined #nim |
14:58:47 | coffeepot | https://gist.github.com/anonymous/b04a5b4dfc32205d9a12 |
14:59:36 | ddl_smurf | (just for my curiosity: is odbc seriously still used ?) |
14:59:42 | coffeepot | sadly yes :( |
14:59:49 | ddl_smurf | sorry bro |
14:59:53 | * | HakanD quit (Ping timeout: 276 seconds) |
15:00:11 | coffeepot | had 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:34 | coffeepot | can't realistically use .NET |
15:00:38 | ddl_smurf | what else was there ? |
15:01:36 | coffeepot | OLE 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:11 | coffeepot | ODBC is a total PTA compared to the other wrappers |
15:02:16 | coffeepot | PITA |
15:05:03 | coffeepot | basically MS wants us to all use ado :( |
15:06:40 | * | Varriount_ joined #nim |
15:09:03 | coffeepot | if anyone's interested i could past the whole module up 'cos I now can't compile it at all :/ |
15:09:49 | Araq | yup do it |
15:09:49 | * | Varriount quit (Ping timeout: 245 seconds) |
15:10:07 | * | Sharcho joined #nim |
15:10:13 | coffeepot | ok - 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:05 | coffeepot | https://gist.github.com/anonymous/925bd88b8f17ff7af332 |
15:11:27 | nimnoob123 | https://github.com/nim-lang/sdl2/pull/41 |
15:12:17 | nimnoob123 | Well that was fun. |
15:12:55 | coffeepot | at least the issue seems reproducible |
15:13:29 | reactormonk | nimnoob123, c2nim fun? |
15:13:57 | * | jefusafk is now known as jefus |
15:14:06 | nimnoob123 | c2nim? i mean the fun part was making sure things worked lol, but the process leading up to that wasn't :( |
15:15:03 | nimnoob123 | I think I learned something from doing that though |
15:16:22 | coffeepot | reposted here https://gist.github.com/anonymous/ef75e830e3346d25a886 |
15:17:30 | coffeepot | lol I am not a clever man https://gist.github.com/anonymous/d4beab152b8444e50b49 |
15:19:52 | ddl_smurf | ole db - i'd feel nostalgic if it werent for the vomit after taste |
15:20:44 | coffeepot | just 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:08 | coffeepot | aside from the interfacting woes I guess it's not too bad. ODBC isn't apparently slow |
15:21:35 | ddl_smurf | oh no, all these techs designed for 64k machines run great now |
15:22:11 | ddl_smurf | i mean it worked on a pentium 75, 8mg ram - seriously it did |
15:22:57 | ddl_smurf | i dont get how NaCl is related to that, you calling odbc from a browser ? |
15:23:59 | coffeepot | nope, 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:18 | coffeepot | but for now i just want to perform a query! |
15:24:29 | ddl_smurf | oh that's cool, a kind of document db ? |
15:25:29 | coffeepot | actually i'd like to make a system api for a product |
15:25:42 | coffeepot | to be used over the intranet |
15:25:45 | ddl_smurf | maybe 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:19 | coffeepot | that doesn't explain why it was working fine and then went kaput |
15:26:31 | coffeepot | been coding it on and off for a while now |
15:27:00 | ddl_smurf | a million things could have changed, if you don't remember, diagnosing at this point will be hard |
15:27:17 | coffeepot | well i can get it to compile now so i guess i found where the issue is |
15:27:23 | coffeepot | i'll carry on narrowing it down |
15:27:31 | ddl_smurf | gl =) |
15:31:46 | coffeepot | this causes the problem: echo "hdnle ", qry.handle |
15:32:10 | coffeepot | handle: TSqlHStmt (basically a pointer IIRC) |
15:32:26 | coffeepot | you know i think i know what it is |
15:32:31 | ddl_smurf | i don't think there is ever a valid reason to generate unparseable C, so this is a compiler bug |
15:32:44 | coffeepot | i agree |
15:33:03 | coffeepot | the problem is my hacky print proc |
15:33:16 | coffeepot | proc `$`(x: TSqlHandle) = |
15:33:16 | coffeepot | if x != nil: |
15:33:16 | coffeepot | var data = cast[ptr int](x)[] |
15:33:16 | coffeepot | echo data |
15:33:16 | coffeepot | else: |
15:33:17 | coffeepot | echo "nil" |
15:33:21 | coffeepot | that's the cause |
15:33:41 | ddl_smurf | that's is exactly the statement i wrote above |
15:34:07 | * | HakanD_ quit (Quit: Be back later ...) |
15:36:03 | nimnoob123 | hey def- if you can check that PR to let me know if that's what you wanted |
15:36:57 | ddl_smurf | that 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:03 | def- | nimnoob123: the top looks fine, and now you can remove cdecl, dynlib: LibName from all the procs |
15:37:20 | nimnoob123 | alright, sec |
15:37:53 | * | grncdr joined #nim |
15:37:56 | def- | nimnoob123: the reason I'm asking for static building is that it's the preferred way to build SDL2 programs with emscripten |
15:38:05 | nimnoob123 | def- is SDL_STATIC case sensitive? |
15:38:16 | nimnoob123 | because you use two different cases on some of your changes |
15:38:16 | def- | nimnoob123: I don't think so, but I never tested |
15:38:26 | coffeepot | yeah the cast is dumb, i just wanted to display the value of the pointer, which you can do with echo repr(ptr) |
15:38:31 | def- | nimnoob123: that's bad anyway, let me fix that |
15:38:36 | coffeepot | actually totally forgot the code was in there :/ |
15:38:39 | grncdr | is it possible to use have an identical field in multiple object variants? |
15:39:10 | def- | grncdr: in some cases, yes |
15:39:45 | def- | https://www.reddit.com/r/programming/comments/2tedjb/what_makes_nim_practical/cnyko39 |
15:40:35 | def- | nimnoob123: Should be SDL_Static, that's what's mostly used |
15:40:50 | grncdr | def-: so the comment replying to yours says it's not possible |
15:40:52 | nimnoob123 | alright, thanks will update |
15:41:01 | grncdr | e.g. I want some but not all variants to have `name: string` |
15:41:58 | grncdr | I guess this is an issue because the field might be at different offsets depending on which variant you have? |
15:43:28 | def- | grncdr: now that you say it, that sounds reasonable |
15:44:37 | grncdr | still seems like something the compiler could maybe handle, but I'm happy enough to skip it and use inheritance for now |
15:47:42 | grncdr | is there a way to associate static data with an object type? |
15:51:00 | grncdr | hm, scratch that, seems like I can get what I want with static[T] and typedesc maybe |
15:51:07 | nimnoob123 | def- alright should be good to go, had to test and clean up some formatting |
15:53:21 | * | JinShil joined #nim |
15:55:41 | nimnoob123 | def- updated the static define's to: SDL_Static, almost forgot |
15:56:29 | * | Trustable joined #nim |
15:58:41 | ldlework | I recovered my meta-programming article |
16:01:29 | * | JinShil quit (Quit: Konversation terminated!) |
16:07:55 | coffeepot | have 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:45 | def- | Huh, what kind of error am I supposed to get with emscripten and Nim's GC? |
16:35:55 | def- | Because it seems to compile and run just fine |
16:36:16 | Araq | never tried it myself |
16:36:26 | Araq | in theory it can work out of the box |
16:36:44 | Araq | depending 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:47 | Strikecarl | how do i execute Powershell commands in nim? |
16:43:26 | Araq | Strikecarl: like anything else. osproc or os.execShellCmd |
16:44:02 | Strikecarl | oh 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:31 | reactormonk | how can I find the next open port I can listen to? |
17:14:47 | reactormonk | just start opening ports and catch the corresponding exception? |
17:14:49 | ddl_smurf | try opening until it works |
17:14:59 | ddl_smurf | if not root, start after 1024 |
17:15:11 | reactormonk | ok |
17:15:57 | ddl_smurf | (fwiw it drives me nuts when software does that, why not just let the user pick his port) |
17:16:19 | reactormonk | ddl_smurf, epc works that way |
17:16:35 | ddl_smurf | what's epc ? |
17:17:22 | reactormonk | https://github.com/kiwanami/emacs-epc |
17:20:47 | reactormonk | how can I reraise the current exception in an except block? |
17:22:08 | reactormonk | https://gist.github.com/7f5467e3b41100d07d8f rough sketch o nhow it should look like |
17:22:11 | BlaXpirit_ | reactormonk, if simply `raise` doesn't work, try raise getcurrentexception |
17:22:17 | BlaXpirit_ | () |
17:22:48 | reactormonk | BlaXpirit_, what would you think of a template `reraise` that does just that? |
17:23:14 | * | aboisvert_ joined #nim |
17:23:15 | BlaXpirit_ | 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:42 | BlaXpirit_ | so minor additions on top of it don't make it better |
17:24:14 | BlaXpirit_ | well actually getCurrentException is useful but I mean having to use it |
17:27:15 | fowl | I agree |
17:27:34 | fowl | Getcurrentexceptionmsg is too damn long too |
17:27:56 | * | BitPuffin|osx joined #nim |
17:32:51 | grncdr | does anybody know of a lib for "declarative" (de)serialization of nim objects? |
17:35:44 | * | ingsoc joined #nim |
17:39:20 | fowl | grncdr: can you elaborate |
17:40:24 | grncdr | I 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:48 | grncdr | that code is verbose and repetitive, so I'm wondering if somebody has already created macros that will write it for me ;) |
17:41:11 | grncdr | also, pretend I wrote "SomeField" in the quotes above, since that's more realistic |
17:41:54 | grncdr | I guess what I'm really wondering, is how do people usually deserialize data to/from their nim types? |
17:42:03 | fowl | Marshal module |
17:42:08 | grncdr | I've only been writing nim for a few hours so I'm probably missing a *lot* |
17:42:13 | grncdr | oh! |
17:42:44 | grncdr | ah, but that only works if I control both ends of communication |
17:43:12 | BlaXpirit_ | grncdr: can you elaborate |
17:43:34 | grncdr | I'm consuming JSON data from some other service |
17:43:53 | BlaXpirit_ | ok, that does explain everything |
17:44:19 | grncdr | so I can't assume that things like "the type of this object represented with a property __type__" etc. |
17:44:34 | grncdr | I could be wrong, but I'm not seeing that the marshal module is all that flexible |
17:44:40 | BlaXpirit_ | nah, grncdr, have u actually seen the output of marshal module? |
17:44:45 | grncdr | nope |
17:44:51 | BlaXpirit_ | so try it out |
17:44:51 | grncdr | I learned about it 30 seconds ago |
17:44:54 | grncdr | ok |
17:44:55 | fowl | Its not a plug and play thing |
17:45:02 | fowl | It is for serialization |
17:45:23 | fowl | Lol |
17:46:37 | grncdr | ok, 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:26 | fowl | What 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:41 | grncdr | anyways, 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:49 | grncdr | thanks |
17:47:49 | fowl | Marshal 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:37 | nimnoob123 | well 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:51 | def- | 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:57 | def- | I hope there's some interesting stuff in there |
19:13:23 | ekarlso | is anyone serious using nim atm ? |
19:20:07 | Araq | ekarlso: yes. |
19:20:12 | ekarlso | Araq: like ? :p |
19:20:32 | Araq | us (3dicc). |
19:20:58 | Araq | there are others too. |
19:21:39 | * | iamd3vil quit (Ping timeout: 264 seconds) |
19:21:51 | ekarlso | Araq: any network services yet ? :p |
19:22:08 | flaviu | You know, I'd love `except OsError err:`. |
19:22:24 | ekarlso | flaviu: +100 |
19:22:43 | Araq | flaviu: implement it. |
19:22:49 | flaviu | using getCurrentException is overly verbose for a pattern that should be the recommended way to do things. |
19:23:05 | Araq | why is it recommended? |
19:23:36 | Araq | what's the point of the exception type when you then have to go on and grab additional information anyway? |
19:23:44 | flaviu | Araq: It's possible to include more information in the error message, sometimes allowing a program to fail more intelligently. |
19:24:06 | flaviu | For 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:29 | fowl | ekarlso, yes fix it please, i miss it |
19:24:39 | ekarlso | :p |
19:24:41 | fowl | er not fix it get it running again |
19:24:50 | def- | I'm also still waiting for nim-play |
19:25:33 | Araq | flaviu: that doesn't make it "recommended" |
19:26:05 | flaviu | "should be the recommended way" :P |
19:26:07 | Araq | but again go ahead and implement it |
19:27:01 | * | flaviu quit (Remote host closed the connection) |
19:27:31 | Araq | though I guess the more consistent syntax is except (foo: OsError): |
19:27:51 | * | flaviu joined #nim |
19:27:58 | fowl | then other exceptions keep unwinding? |
19:28:01 | def- | yes, "except OsError err:" could also be parsed as "except OsError(err):" |
19:28:25 | Araq | fowl: just like it is now |
19:28:55 | fowl | Araq, oh and foo would be (ref OSError)(getCurrentException()) ? |
19:29:03 | Araq | fowl: yes |
19:29:16 | Araq | or maybe the syntax should be: |
19:29:22 | Araq | except OsError as foo: |
19:29:24 | Araq | ? |
19:29:28 | Araq | dunno |
19:29:55 | fowl | i would expect except(foo: Err): |
19:30:25 | * | milosn quit (Ping timeout: 250 seconds) |
19:30:28 | flaviu | Araq: I understand where you're coming from, I too have a busy schedule right now. |
19:30:57 | flaviu | I might have some free time late next week though, I'll look into it then. |
19:32:13 | flaviu | btw, 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:52 | def- | 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:08 | dom96 | flaviu: +1. I've wanted this since forever. |
19:49:40 | * | gokr_ joined #nim |
19:52:40 | * | Sharcho joined #nim |
19:56:15 | HakanD_ | Porting a NES Emulator from Go to Nim, 2nd on HN front page. I love the attention Nim gets on HN |
19:58:12 | dom96 | Yeah, def- is doing a really good job promoting Nim. |
20:01:10 | * | vendethiel quit (Ping timeout: 255 seconds) |
20:02:44 | HakanD_ | Now, if only we could get some coverage and end this wikipedia siliness once and for all |
20:03:49 | def- | 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:00 | HakanD_ | You write good blog posts (: |
20:05:31 | def- | Thanks |
20:07:13 | Araq | def-: yeah superb work! |
20:08:03 | renesac | idea that I gave before: ping suitable news sites about nim release and link that def- blog post too |
20:08:18 | HakanD_ | I found Nim via HN, and got hooked to it after reading your blog posts |
20:08:44 | renesac | and try to prod them to try out nim and write something non-trivial that could be used as wikipedia source |
20:09:16 | renesac | and yeah, suberb work def- |
20:09:42 | dom96 | def-: it's odd, but it seems that Reddit prefers the Github link. |
20:10:16 | def- | 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:07 | flaviu | def-: Let's stay away from accusing people/groups without strong evidence. |
20:11:20 | def- | flaviu: sorry, right. wasn't entirely serious |
20:12:11 | flaviu | my bad then, tone is hard to hear over text :) |
20:12:27 | HakanD_ | don't know about go, but people love to compare Nim with Rust, for one reason or another |
20:13:08 | HakanD_ | nearly every nim topic includes a rust comparison, and rust people chimming in after |
20:13:55 | flaviu | Nim and Rust are aiming at a similar audience. |
20:17:08 | * | shodan45 quit (Quit: Konversation terminated!) |
20:17:27 | HakanD_ | anyways, a good day for nim |
20:17:31 | HakanD_ | 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:21 | gmpreussner|work | im on a fresh windows box with nim at head @ devel. can't compile c2nim at head: "Error: Cannot open 'compiler/llstream'" |
20:33:35 | gmpreussner|work | i think i've seen this before a couple months ago, but can't remember what was wrong/missing |
20:33:42 | gmpreussner|work | does anyone know? |
20:33:45 | def- | nimble install compiler? |
20:34:27 | gmpreussner|work | i have nim/bin in my PATH. is that not enough? |
20:34:29 | def- | on Linux it gets installed automatically, strange |
20:34:55 | def- | When you do "nimble install c2nim" doesn't it get the compiler package first? |
20:35:18 | gmpreussner|work | i didnt install via nimble. i grabbed my fork from github |
20:35:22 | gmpreussner|work | for both |
20:35:53 | def- | c2nim needs the compiler package, not sure how to do that without nimble |
20:36:02 | gmpreussner|work | oh i see |
20:36:30 | gmpreussner|work | so the compiler/ folder is not searched automatically? |
20:36:58 | def- | not sure |
20:41:21 | gmpreussner|work | passing the path to nim via -p works |
20:41:23 | gmpreussner|work | odd |
20:41:44 | Araq | gmpreussner|work: my c2nim doesn't have any .nim.cfg either. maybe dom96 removed it? |
20:42:11 | Araq | usually there is a config which sets -p:$nim/compiler |
20:42:27 | gmpreussner|work | ah, that might be it |
20:43:01 | * | BitPuffin|osx joined #nim |
20:44:04 | gmpreussner|work | this change maybe: https://github.com/nim-lang/c2nim/commit/f408d1594cf32aef7fe5b225b52104967d435146 |
20:44:43 | Araq | yeah |
20:48:18 | * | flaviu quit (Remote host closed the connection) |
20:48:59 | * | TEttinger joined #nim |
20:55:34 | * | nimnoob123 joined #nim |
20:56:16 | nimnoob123 | hey fowl let me know if that syntax change works for you https://github.com/nim-lang/sdl2/pull/41#issuecomment-98192198 |
20:57:27 | fowl | Thanks nimnoob123 I will merge it in a sec |
20:57:37 | fowl | Looks fine btw |
20:57:44 | nimnoob123 | cool, thanks. was fun :) |
20:57:49 | * | vendethiel joined #nim |
20:58:17 | dom96 | gmpreussner|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:20 | Araq | if somebody wants something easy to do |
21:08:08 | Araq | add GCC's builtins to lib/system/arithm.nim to get much more efficient overflow detection |
21:08:43 | * | foobar_ joined #nim |
21:09:12 | foobar_ | Hey, I was wondering about the JS backend. Does it use Emscripten? |
21:09:19 | fowl | Is there any way to get the c compiler |
21:09:21 | def- | Araq: Ha, I thought about exactly that |
21:09:51 | def- | foobar_: No, it's written in Nim directly, but you can use emscripten instead |
21:09:55 | fowl | So I can tell if its GCC of msvc |
21:10:09 | Araq | fowl: when defined(gcc) ? |
21:10:14 | Araq | when defined(vcc) ? |
21:10:32 | fowl | That will work |
21:10:33 | foobar_ | 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:35 | Araq | foobar_: no, it doesn't |
21:10:56 | Araq | foobar_: our JS backend predates emscripten |
21:11:10 | foobar_ | OK |
21:11:34 | foobar_ | If I use emscripten, should it work out of the box for nim? |
21:11:59 | Araq | def- says it does, filwit says it doesn't. |
21:12:22 | Araq | so ... I don't know |
21:12:22 | foobar_ | hmm |
21:12:36 | def- | foobar_: Worked for me here: http://hookrace.net/blog/porting-nes-go-nim/ |
21:12:45 | foobar_ | Oh, you write hookrace? |
21:13:09 | def- | Right |
21:15:57 | foobar_ | def-: What modifications, if any, were necessary for the glory that is http://hookrace.net/nimes/ |
21:16:05 | foobar_ | From the nim source, that is |
21:16:10 | foobar_ | To get it to compile to working js |
21:16:35 | foobar_ | Also, how many nim lines? |
21:17:14 | fowl | He used emscripten for that |
21:17:46 | foobar_ | I know, but are any special libraries or anything necessary to interface to the js stuff? |
21:17:52 | * | grncdr joined #nim |
21:18:04 | foobar_ | I mean, I know its a direct source-to-source compilation, but maybe graphics libs are different? |
21:19:17 | fowl | Dunno 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:08 | def- | Oh, I'm too late. It was pretty easy and the article explains it. Basically SDL2 does all the work already |
21:24:04 | fowl | Does sdl2 get compiled when the page is loaded? |
21:24:20 | def- | No, it's precompiled |
21:24:28 | * | gokr_ quit (Remote host closed the connection) |
21:24:30 | fowl | Oh |
21:24:53 | def- | into a 1 MB JavaScript file: http://hookrace.net/nimes/nimes.js |
21:25:46 | saml | wow nim real web scale |
21:25:48 | fowl | Emscripten precompiles sdl2 into js? O.o |
21:25:55 | saml | how do I upgrade nimble? |
21:26:11 | fowl | Nimble install nimble |
21:26:13 | def- | fowl: Only the current HG version of sdl2, unreleased so far, but they have excellent emscripten support now |
21:26:54 | saml | nimble install nimble fails |
21:26:58 | * | gokr_ joined #nim |
21:27:36 | def- | saml: then manually from https://github.com/nim-lang/nimble I guess |
21:27:53 | fowl | nimble@#head will try live version |
21:28:54 | saml | that worked |
21:28:59 | fowl | def-: 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:26 | def- | 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:47 | def- | fowl: I guess someone should test a program that actually allocates some memory |
21:31:20 | Araq | yeah, like some GC test ... |
21:31:44 | fowl | Nes back end for Nim plz |
21:33:17 | BlaXpirit_ | kek |
21:35:25 | BlaXpirit_ | guys... |
21:35:27 | * | gsingh93 quit (Ping timeout: 256 seconds) |
21:35:31 | BlaXpirit_ | 0.11.0 silently broke docopt.nim |
21:35:40 | BlaXpirit_ | I have no idea what happened, only half of tests pass now |
21:36:01 | BlaXpirit_ | most curious thing is, everything was fine on devel 2 weeks ago |
21:39:46 | Araq | BlaXpirit_: well report it properly. this time we can do 0.11.2 |
21:40:02 | BlaXpirit_ | i don't know what to report, where to look |
21:40:13 | BlaXpirit_ | difficult to investigate |
21:40:15 | * | Ven_ joined #nim |
21:41:39 | def- | BlaXpirit_: bisect the compiler repo |
21:41:45 | BlaXpirit_ | oh yeah |
21:41:51 | BlaXpirit_ | there is that |
21:43:00 | * | keypusher quit (Quit: Konversation terminated!) |
21:43:15 | * | keypusher joined #nim |
21:43:34 | BlaXpirit_ | def-, how do i tell it where to start from? |
21:43:45 | def- | git bisect start |
21:43:57 | def- | hm no |
21:44:02 | def- | git-bisect good (or bad) |
21:44:23 | BlaXpirit_ | well is it gonna check until the very beginning? |
21:44:33 | def- | I think you have to find a good commit first |
21:44:37 | def- | and start from there |
21:44:47 | def- | you can use ./koch temp c foo.nim for faster recompilation |
21:45:06 | def- | git bisect run ./koch temp c foo.nim |
21:45:16 | Araq | it's commit 26eae7d00e73c656 anyway |
21:45:44 | Araq | was a highly risky change to the compiler |
21:45:46 | * | saml quit (Quit: Leaving) |
21:46:53 | Araq | but it was so annoying to fix that I couldn't go back |
21:47:01 | BlaXpirit_ | Araq, commit before it works well |
21:47:20 | Araq | yeah I can imagine |
21:47:21 | BlaXpirit_ | checking the commit itself now... |
21:48:00 | BlaXpirit_ | Araq, fails |
21:48:03 | BlaXpirit_ | so what is it? |
21:48:14 | BlaXpirit_ | https://github.com/Araq/Nim/commit/26eae7d00e73c65670775091bad8bfd796b3e1f1 |
21:48:16 | Araq | see? I'm better than git bisect. |
21:48:31 | BlaXpirit_ | so fast |
21:48:35 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:49:55 | BlaXpirit_ | so then, what should i report? |
21:50:12 | Araq | something thats 1 file without deps and fails |
21:50:27 | Araq | can be a large file, i don't care |
21:50:49 | BlaXpirit_ | Araq, at least tell me what was changed there! |
21:50:53 | Araq | but it will be another test case, so I don't want dependencies |
21:50:56 | BlaXpirit_ | it's got to be something about methods |
21:51:15 | Araq | BlaXpirit_: how types are computed. |
21:51:26 | Araq | usually sets or tuples are affected by this |
21:52:20 | Araq | also note that this patch got rid of a section that reads "# XXX finally rewrite that crap!" |
21:52:30 | Araq | :P |
21:53:16 | * | Matthias247 quit (Quit: Matthias247) |
21:53:39 | BlaXpirit_ | no, i'm almost sure it's methods |
21:53:58 | Araq | methods are hardly affected by this patch though |
21:54:13 | Araq | but we'll see |
21:54:31 | BlaXpirit_ | is there even a basic test for dynamic dispatch in tests? |
21:54:44 | Araq | yes. lots of. |
21:54:57 | BlaXpirit_ | but hmm if basic things failed, even half of tests wouldn't pass |
21:55:23 | thotypous | BlaXpirit_: did you test with commit just before that to be sure it is really the culprit? |
21:55:39 | * | enquora joined #nim |
21:55:43 | BlaXpirit_ | thotypous, [:46:59] <BlaXpirit_> Araq, commit before it works well |
21:55:51 | thotypous | ah sorry didn't read |
21:56:49 | def- | Araq: ok, the gctest throws an exception with emscripten |
21:58:04 | reactormonk | def-, got a bit more information? |
21:58:14 | BlaXpirit_ | gaaah i don't know how to test this |
21:58:33 | def- | 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:01 | def- | reactormonk: works with markandsweep! |
22:02:18 | * | enquora joined #nim |
22:03:11 | def- | reactormonk: or not, just runs longer |
22:04:08 | def- | 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:20 | Araq | interesting |
22:05:45 | def- | 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:16 | federico3 | def-: are you the author of what-makes-nim-practical? |
22:12:09 | Araq | good night guys. I won't be here tomorrow, hope you'll manage to survive without me ;-) |
22:12:18 | BlaXpirit_ | but but nim is broken D: |
22:13:11 | def- | federico3: yes |
22:13:22 | federico3 | def-: very nice article, thank you for this |
22:13:39 | def- | Good night Araq |
22:13:48 | def- | Thanks federico3, glad that you like it |
22:16:00 | ldlework | woooo! http://blog.ldlework.com/ |
22:16:40 | ldlework | Now, I can blog about nim more. |
22:19:17 | * | grncdr1 quit (Quit: Leaving.) |
22:19:37 | def- | ldlework: Nice, is that an old article? |
22:19:39 | * | X-Scale joined #nim |
22:20:48 | Varriount_ | ldlework: If only wikipedia viewed you as a 'reliable resource' |
22:20:53 | * | Varriount_ is now known as Varriount |
22:21:46 | ldlework | def-: that's my old article yeah |
22:21:54 | ldlework | def-: my blog server got pwned and locked down by digital ocean |
22:22:07 | ldlework | so I had to recover, so my publication dates were lost |
22:22:59 | nimnoob123 | idlework what theme is that? |
22:23:31 | Varriount | Araq: tscheduler.nim is hanging on win32 |
22:25:20 | * | yglukhov_ quit (Quit: Be back later ...) |
22:26:10 | federico3 | def-: should we distribute nimscript as /usr/bin/nimscript as part of the compliler? |
22:29:24 | def- | federico3: I'm not sure. It requires tcc as it is |
22:30:26 | Varriount | federico3, def-: Whats NimScript? |
22:31:45 | def- | Varriount: http://hookrace.net/blog/what-makes-nim-practical/#use-as-a-scripting-language |
22:32:19 | BlaXpirit_ | https://github.com/flaviut/nimrun/blob/master/nimrun |
22:32:23 | BlaXpirit_ | (see also) |
22:33:00 | Varriount | Ah, ok |
22:34:04 | * | Kingsquee joined #nim |
22:35:20 | nimnoob123 | damn small world BlaXpirit_ just seen your crystal crsfml project, nice |
22:35:30 | BlaXpirit_ | uh ok thanks |
22:36:35 | federico3 | def-: either there could be a nim-tcc-script and nim-gcc-script, or just error out if tcc isnot there |
22:37:49 | BlaXpirit_ | or try tcc then any compiler |
22:38:01 | federico3 | I could imagine a nim-script package that depends on tcc |
22:38:53 | federico3 | autoselecting compilers sounds very risky :) |
22:39:45 | BlaXpirit_ | well isn't that what nim does |
22:40:03 | BlaXpirit_ | maybe it doesn't, doesn't matter |
22:40:23 | BlaXpirit_ | what i mean is try tcc then nim's default |
22:40:29 | onionhammer | def- awesome work on that NES emulator port. very clean :) |
22:40:34 | federico3 | even if, nim is used by developers, nimscript could be used by unaware users that just run ./foo.nim |
22:42:17 | BlaXpirit_ | is it possible that seq doesn't have copy semantics anymore? |
22:42:37 | BlaXpirit_ | this is taking forever to debug |
22:42:55 | def- | BlaXpirit_: that would be shocking. i can't believe my tests could've missed that |
22:42:56 | * | RaphaelHythloday joined #nim |
22:43:54 | def- | 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:24 | BlaXpirit_ | i always do that |
22:44:25 | def- | BlaXpirit_: how's crystal compared to Nim btw? |
22:44:28 | BlaXpirit_ | but you don't understand |
22:44:42 | BlaXpirit_ | i can't find where the error is even with the complete thing |
22:45:31 | def- | insert debug outputs everywhere and compile with working and non-working compiler to see where the difference happens |
22:45:38 | BlaXpirit_ | i'm doing exactly that |
22:46:37 | BlaXpirit_ | how's crystal compared to Nim: it is much closer to what I was seeking in a language |
22:46:51 | BlaXpirit_ | I want Python but fast. it is Ruby but fast. close enough... |
22:47:35 | federico3 | uh, nimes is not compiling for me - range is empty at nes/types.nim(59, 30) |
22:47:40 | def- | Yeah, Nim isn't exactly "Python but fast", but I like the differences |
22:47:49 | def- | federico3: compiler version? |
22:48:02 | federico3 | 0.10.2 |
22:48:06 | def- | That doesn't work |
22:48:15 | def- | That's why I waited until 0.11.0 was released |
22:48:58 | BlaXpirit_ | personally I don't see much use for Nim :( |
22:49:15 | BlaXpirit_ | I tried to apply it to game dev, it does not fit my needs |
22:49:31 | BlaXpirit_ | and for the rest i have Python |
22:49:35 | federico3 | oops, sorry, I missed the line where you mentione dit |
22:56:01 | BlaXpirit_ | i dont know what's going on |
22:56:17 | BlaXpirit_ | it's almost like... i'm passing a seq of len 2 and the function sees it at len 0 |
22:58:23 | BlaXpirit_ | so result is a tuple |
22:58:25 | BlaXpirit_ | result = pattern.match(result.left, result.collected) |
22:58:50 | BlaXpirit_ | result.left.len == 2 but function match gets result.left.len == 0 |
22:59:05 | BlaXpirit_ | i hope this is it... |
23:03:10 | nimnoob123 | is 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:01 | BlaXpirit_ | re was not updated |
23:04:19 | BlaXpirit_ | and will not be significantly changed |
23:04:42 | BlaXpirit_ | might be deprecated though |
23:05:18 | nimnoob123 | ah, thanks |
23:05:36 | BlaXpirit_ | aww yiss, i found the bug |
23:07:06 | DSAFDSGFD | what was it |
23:07:31 | BlaXpirit_ | 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:52 | BlaXpirit_ | the bug: https://github.com/Araq/Nim/issues/2630 |
23:13:58 | * | Siecje joined #nim |
23:15:45 | BlaXpirit_ | this is pretty rare, but just impossible to debug |
23:17:33 | * | banister joined #nim |
23:19:36 | * | HakanD_ joined #nim |
23:21:33 | Siecje | Is there a template library that plays nice with nim? |
23:21:49 | federico3 | can I build the entire docs in an epub? |
23:22:06 | BlaXpirit_ | Siecje, uh sure |
23:22:12 | BlaXpirit_ | but you gotta be specific |
23:22:54 | Siecje | BlaXpirit_: Templating engine* |
23:23:02 | BlaXpirit_ | nope |
23:23:10 | BlaXpirit_ | don't know what you mean |
23:23:45 | * | HakanD_ quit (Ping timeout: 244 seconds) |
23:25:33 | Siecje | BlaXpirit_: For example in the Python ecosystem there is Jinja2, mako, Django templates, etc. In JavaScript there is Jade, EJS, skinny, etc |
23:25:47 | BlaXpirit_ | that's gonna be https://github.com/onionhammer/nim-templates |
23:26:02 | BlaXpirit_ | or same thing in 30 lines of code xD https://github.com/BlaXpirit/nimception |
23:27:24 | federico3 | def-: now it's not finding sdl2. I have libsdl2-dev installed. |
23:27:42 | BlaXpirit_ | but do u have nim package sdl2 installed? |
23:27:44 | def- | federico3: not finding the nimble sdl2 package? |
23:28:19 | def- | if you build with "nimble build" it should download it automatically |
23:28:21 | federico3 | aha, I need a Nim sdl2 as well, ok |
23:30:08 | def- | 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:22 | def- | http://nim-lang.org/0.11.0/filters.html |
23:30:48 | BlaXpirit_ | dang it |
23:31:23 | BlaXpirit_ | so i reinvented the wheel |
23:31:32 | DSAFDSGFD | theres some sdl2 constant missing in the wrapper |
23:31:38 | DSAFDSGFD | constants* |
23:31:40 | Siecje | Hey def- nice blog posts :) |
23:31:49 | BlaXpirit_ | def-, why didn't nobody tell me that I reinvented "filters" in https://github.com/BlaXpirit/nimception |
23:32:19 | def- | BlaXpirit_: From what I remembered Araq showed your filters and you said they weren't powerful enough (but I may be misremembering) |
23:32:20 | BlaXpirit_ | lol it looks exactly the same |
23:32:31 | federico3 | uh, there's a bug in nible: https://github.com/nim-lang/packages/raw/master/packages.json is hitting a redirect |
23:33:07 | def- | DSAFDSGFD: So it doesn't work? You could make a pull request |
23:33:37 | def- | federico3: That may be a bug in Nim 0.10.2 |
23:34:10 | DSAFDSGFD | def-: it works, just missing some constants about opengl |
23:34:10 | def- | federico3: you could try rebuilding nimble with the new nim |
23:34:17 | DSAFDSGFD | SDL_GLprofile enum |
23:34:22 | DSAFDSGFD | SDL_GL_CONTEXT_PROFILE_CORE* = cint(0x0001) |
23:34:24 | DSAFDSGFD | etc.. |
23:34:51 | def- | 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:57 | DSAFDSGFD | o ok |
23:35:09 | def- | But PRs are always welcome |
23:35:24 | DSAFDSGFD | kk i might do that, theres some stuff wrong in the opengl wrapper too |
23:35:38 | DSAFDSGFD | pointer with size int32 |
23:35:47 | DSAFDSGFD | instead of machine dependant |
23:35:58 | BlaXpirit_ | def-, are these source code filters built into the compiler? |
23:36:01 | federico3 | def-: I used 0.11 |
23:36:12 | DSAFDSGFD | anyway ill look at making some pull request sometimes |
23:36:27 | BlaXpirit_ | i suppose reinventing them in userland is something... |
23:36:56 | def- | BlaXpirit_: I assume so |
23:37:11 | federico3 | hm, it seems to be working now |
23:37:54 | Siecje | I'm looking for something that can do template inheritance |
23:37:58 | onionhammer | Siecje see http://www.eoleary.me/Blog/The-Templates-Library |
23:39:41 | * | BlaXpirit-UA joined #nim |
23:39:51 | BlaXpirit-UA | pretty sure there is no templ. lib with inheritance |
23:39:56 | fowl | opengl is a joke atm |
23:40:00 | fowl | someone messed it up |
23:40:53 | * | BlaXpirit_ quit (Ping timeout: 250 seconds) |
23:40:58 | onionhammer | Siecje how do you mean inheritance? |
23:41:13 | BlaXpirit-UA | :s |
23:41:26 | onionhammer | https://github.com/onionhammer/samplenimweb |
23:41:29 | onionhammer | another usage |
23:41:31 | Siecje | onionhammer: Have a base template with html boilerplate and have page templates use the boilerplate |
23:41:39 | onionhammer | yeah you can do that |
23:41:42 | onionhammer | with nim-templates |
23:41:53 | onionhammer | https://github.com/onionhammer/samplenimweb/blob/master/master.nim |
23:42:20 | onionhammer | you can do it in a more sophisticted way than that using templates instead of procs |
23:42:30 | onionhammer | nim-templates only works at compile-time though |
23:43:45 | Siecje | onionhammer: and $content can be another template? |
23:45:06 | onionhammer | if its a template it has to be ${ content } |
23:45:15 | onionhammer | $content basically means "this variable as a string" |
23:45:18 | BlaXpirit-UA | Siecje, no inheritance. basically what happens here is the result of rendering one template is passed as a variable to the master template |
23:45:30 | onionhammer | no.. |
23:45:54 | onionhammer | nim-templates basically translates the input string into nim code at compile time |
23:46:05 | onionhammer | so you can pass in other nim code at compile time |
23:46:14 | onionhammer | it doesnt have to be generated string BlaXpirit-UA |
23:47:17 | onionhammer | i.e. tmpl html"<div>$var</div>" => result.add("<div>"); result.add(var); result.add("</div>") at compile time |
23:47:34 | BlaXpirit-UA | onionhammer, i get it |
23:47:55 | BlaXpirit-UA | like i keep saying, i implemented such templates in 30 lines of code https://github.com/BlaXpirit/nimception https://gist.github.com/7e4a445f5c64ef658d2d |
23:47:57 | onionhammer | so 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:19 | Siecje | onionhammer: Thanks for explaining |
23:50:20 | BlaXpirit-UA | in your example you're just passing a rendered string to another template... that's what i'm saying |
23:50:29 | onionhammer | no |
23:50:34 | Siecje | BlaXpirit-UA: no it gets expanded |
23:50:42 | ldlework | That's what he's saying |
23:50:43 | onionhammer | exactly, it gets expanded |
23:50:47 | ldlework | all it is passing is an expanded template |
23:50:48 | BlaXpirit-UA | content: string ?? |
23:51:03 | onionhammer | content is a template, not a string |
23:51:23 | onionhammer | you're injecting code into it |
23:51:28 | ldlework | This sounds like composition rather than inheritance |
23:51:40 | BlaXpirit-UA | well of course it is not inheritance |
23:51:52 | ldlework | Well some template systems support inheritance |
23:52:02 | ldlework | IE, explicit overrides of marked blocks |
23:52:03 | Siecje | <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:09 | onionhammer | ldlework I asked what was meant by inheritance |
23:52:09 | BlaXpirit-UA | but what are we talking about here... **content: string** |
23:52:25 | ldlework | Why anyone would want to use a compile-time template engine anyway is strange...(digress) |
23:52:39 | BlaXpirit-UA | http://jinja.pocoo.org/docs/dev/templates/#template-inheritance |
23:52:44 | ldlework | BlaXpirit-UA: +1 |
23:52:49 | onionhammer | ldlework why wouldnt you? |
23:52:55 | ldlework | onionhammer: because I have runtime data? |
23:53:01 | ldlework | I'm rendering a template in response to? |
23:53:13 | ldlework | Like, 99% of the use-cases of template engines today? |
23:53:13 | onionhammer | you can still use dynamic data in the template |
23:53:18 | onionhammer | but the template itself is static |
23:53:31 | Siecje | onionhammer: Can you explain that |
23:53:35 | ldlework | I guess I haven't looked at nim-templates well enough then |
23:53:54 | BlaXpirit-UA | ldlework, that's like saying why would i use a compiled programmign language if i have runtime data :p |
23:53:54 | ldlework | When I looked at it for the use of generating web-pages I remember feeling dumbfounded |
23:54:03 | onionhammer | Siecje ldlework basically it means you have to recompile the program if you change the structure of your html page |
23:54:22 | onionhammer | but you can still display dynamic variables/loop/if/else etc dynamically |
23:54:26 | onionhammer | just like any other nim code |
23:54:36 | onionhammer | and it will generate different output, but the template code remains the same |
23:55:20 | ldlework | What about dynamically including other templates? |
23:55:21 | onionhammer | tmpl html"<div>$name</div>" where name <= some user input |
23:55:39 | onionhammer | sure ldlework, but there you would end up passing in a rendered string |
23:55:50 | * | foobar42 quit (Ping timeout: 256 seconds) |
23:55:56 | BlaXpirit-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:58 | BlaXpirit-UA | [:50:27] <onionhammer> no |
23:56:03 | BlaXpirit-UA | [:55:38] <onionhammer> sure ldlework, but there you would end up passing in a rendered string |
23:56:08 | BlaXpirit-UA | k |
23:56:18 | onionhammer | right |
23:56:23 | ldlework | lol |
23:57:05 | onionhammer | i guess i need to write better examples for it lol |
23:57:10 | onionhammer | it's not that inflexible |
23:57:29 | ldlework | What's the point in 'compiling' templates? |
23:57:46 | onionhammer | so that I can use nim to do all the logic |
23:57:48 | BlaXpirit-UA | ldlework, the point is it is extremely easy to make templates like that |
23:58:02 | BlaXpirit-UA | let me just spam with https://github.com/BlaXpirit/nimception yet again |
23:58:27 | BlaXpirit-UA | templating language almost like onionhammer's project IN 30 LINES OF CODE |
23:58:47 | ldlework | 43 technically |
23:59:04 | BlaXpirit-UA | after 33 is just a demo |
23:59:06 | ldlework | oh that's an example |
23:59:09 | BlaXpirit-UA | and there are empty lines |
23:59:14 | fowl | can you use it twice |
23:59:14 | ldlework | lol |
23:59:30 | onionhammer | <div>$if condition { <div>one thing</div> } else { <div>another</div> }</div> |
23:59:33 | fowl | Seems like the compile time function you have to define could only be defined once |
23:59:43 | ldlework | onionhammer: no |