00:00:25 | * | Trustable quit (Remote host closed the connection) |
00:06:51 | * | endragor joined #nim |
00:10:51 | * | fredrik92 quit (Quit: Leaving.) |
00:11:03 | * | endragor quit (Ping timeout: 240 seconds) |
00:11:14 | * | fredrik92 joined #nim |
00:30:36 | * | krux02 joined #nim |
00:35:49 | * | ftsf_ joined #nim |
00:46:40 | * | chemist69 quit (Ping timeout: 255 seconds) |
00:47:28 | * | fredrik92 quit (Quit: Leaving.) |
00:47:40 | * | chemist69 joined #nim |
00:48:43 | * | endragor joined #nim |
00:49:34 | * | fredrik92 joined #nim |
00:51:08 | * | endragor quit (Remote host closed the connection) |
00:51:24 | * | endragor joined #nim |
01:11:50 | * | fredrik92 quit (Read error: Connection reset by peer) |
01:13:48 | * | krux02 quit (Quit: Verlassend) |
01:14:00 | * | GangstaCat quit (Quit: Leaving) |
01:14:16 | * | chemist69 quit (Ping timeout: 264 seconds) |
01:16:07 | * | endragor quit (Remote host closed the connection) |
01:27:16 | * | chemist69 joined #nim |
01:30:28 | * | honkfestival joined #nim |
01:31:11 | kier | what's the best way to ask Nim to use a different C compiler to the default? |
01:31:42 | kier | I can't see an flag in the help, nor does setting the CC env var seem to be doing anything |
01:31:53 | kier | s/an flag/a flag/ |
01:36:52 | ftsf_ | kier, nim c -d:gcc.exe mycustomgcc |
01:36:59 | ftsf_ | http://nim-lang.org/docs/nimc.html |
01:37:21 | ftsf_ | you might have to tweak a bunch of settings |
01:37:26 | * | endragor joined #nim |
01:37:28 | kier | ftsf_: thanks. I just discovered the --cc option which worked as well |
01:38:09 | ftsf_ | ooh interesting, that doesn't seem to be documented |
01:39:31 | kier | doesn't look like it. only came across it in a forum post |
01:39:55 | kier | maybe "document all the secret compiler options" should be an issue :p |
01:40:23 | ftsf_ | =) yeah |
01:42:26 | * | endragor quit (Remote host closed the connection) |
01:42:46 | mcc | There are lots of docs issues to be raised |
01:43:10 | * | endragor joined #nim |
01:43:10 | mcc | I keep meaning to start filing pull requests whenever i learn something that isn't in the docs *_* |
01:45:46 | * | yglukhov joined #nim |
01:48:25 | * | PMunch quit (Quit: leaving) |
01:50:37 | * | yglukhov quit (Ping timeout: 265 seconds) |
01:52:25 | * | endragor quit (Remote host closed the connection) |
01:55:00 | * | rtr_ quit (Remote host closed the connection) |
02:11:19 | FromGitter | <yuutayamada> seems like nimsuggest repo doesn't activate travis webhook yet |
02:13:12 | * | dddddd quit (Ping timeout: 240 seconds) |
02:13:14 | * | GangstaCat joined #nim |
02:15:58 | * | endragor joined #nim |
02:20:52 | * | endragor quit (Ping timeout: 264 seconds) |
02:24:46 | * | endragor joined #nim |
02:25:05 | * | endragor quit (Client Quit) |
02:54:58 | * | rtr_ joined #nim |
02:57:01 | * | pie_ quit (Ping timeout: 244 seconds) |
02:59:35 | * | rtr__ joined #nim |
03:00:38 | * | bungoman joined #nim |
03:01:20 | * | rtr_ quit (Ping timeout: 244 seconds) |
03:09:44 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:47:32 | * | yglukhov joined #nim |
03:51:56 | * | yglukhov quit (Ping timeout: 244 seconds) |
04:39:38 | * | fastrom1 quit (Quit: Leaving.) |
05:48:52 | * | Demon_Fox quit (Quit: Leaving) |
05:49:31 | * | yglukhov joined #nim |
05:53:49 | * | yglukhov quit (Ping timeout: 250 seconds) |
06:18:10 | * | csoriano joined #nim |
06:37:44 | * | chemist69 quit (Ping timeout: 260 seconds) |
06:41:54 | * | chemist69 joined #nim |
06:43:43 | * | mcc quit (Quit: Connection closed for inactivity) |
06:45:06 | * | fastrom joined #nim |
06:46:05 | flyx | pong Araq |
06:55:50 | * | brechtm_ quit (Read error: Connection reset by peer) |
06:55:56 | * | brechtm joined #nim |
06:56:19 | * | Trustable joined #nim |
07:03:29 | * | lyro joined #nim |
07:10:31 | * | Arrrr joined #nim |
07:19:10 | * | yglukhov joined #nim |
07:25:19 | * | bjz joined #nim |
07:40:20 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
07:41:37 | * | csoriano quit (Quit: csoriano) |
07:41:52 | * | csoriano joined #nim |
07:42:23 | Arrrr | Interesting that the first dump doesn't work http://pastebin.com/rqgpRyq8 |
07:42:26 | Arrrr | Is it a bug? |
07:48:35 | * | bjz joined #nim |
07:51:35 | flyx | Arrrr: I'd say that is just invalid syntax |
07:52:59 | Arrrr | Mmm, it is possible that, in the second case, understands i(int) as the result of a proc call? |
07:53:09 | Arrrr | i didn't look at i in that way |
07:53:37 | flyx | yes |
07:54:19 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
07:54:25 | flyx | but I am not even sure if that is the problem. `case` afaik wants its of branches indented if the case statement ends with a `:` |
07:54:52 | flyx | which would explain the „invalid indentation“ error |
07:57:28 | * | bjz joined #nim |
07:58:11 | * | Arrrr quit (Ping timeout: 250 seconds) |
08:02:01 | * | Andris_zbx joined #nim |
08:02:10 | * | xet7 quit (Ping timeout: 252 seconds) |
08:04:23 | * | Arrrr joined #nim |
08:04:23 | * | Arrrr quit (Changing host) |
08:04:23 | * | Arrrr joined #nim |
08:04:40 | Arrrr | Still i get the same error with and without the last ':' |
08:04:50 | Arrrr | So i suppose you are right here. |
08:05:32 | Arrrr | Probably it expects to be inside a type |
08:08:58 | flyx | er, no, for that you'd need var, let or const |
08:09:04 | flyx | it expects to be inside a `case` |
08:09:14 | * | samuell joined #nim |
08:09:21 | flyx | the parser reads `case i:` and then it expects a newline and indented of branches |
08:09:25 | flyx | instead it gets an `int` |
08:11:16 | Arrrr | Ah, ok, i understand why in this case i get the error. I mean that for case objects i would not get the error, but i'm using it outside a type |
08:13:11 | flyx | ah, now I understand what you want to do ^^ |
08:13:31 | flyx | I did not realize you want a variant object case |
08:27:26 | * | vegansk joined #nim |
08:27:50 | * | vegansk quit (Client Quit) |
08:38:17 | * | ftsf_ quit (Remote host closed the connection) |
09:08:33 | euantor | @dom96/ or @Araq http://forum.nim-lang.org/t/2514 - spam content on the forum |
09:18:14 | * | brechtm_ joined #nim |
09:20:14 | * | brechtm__ joined #nim |
09:20:14 | * | brechtm__ quit (Read error: Connection reset by peer) |
09:21:03 | * | brechtm quit (Ping timeout: 244 seconds) |
09:23:20 | * | brechtm joined #nim |
09:23:35 | * | brechtm_ quit (Ping timeout: 265 seconds) |
09:24:56 | * | brechtm quit (Read error: Connection reset by peer) |
09:25:02 | * | brechtm_ joined #nim |
09:31:38 | * | brechtm joined #nim |
09:33:20 | * | brechtm__ joined #nim |
09:34:40 | * | brechtm_ quit (Ping timeout: 264 seconds) |
09:36:59 | * | ruslux joined #nim |
09:37:03 | * | brechtm quit (Ping timeout: 258 seconds) |
09:37:45 | * | ruslux quit (Client Quit) |
09:40:06 | * | gokr joined #nim |
09:48:08 | * | GangstaCat quit (Quit: Leaving) |
10:12:44 | * | fredrik92 joined #nim |
10:13:23 | * | fredrik92 quit (Client Quit) |
10:14:10 | * | rtr__ quit (Remote host closed the connection) |
10:14:44 | * | fredrik92 joined #nim |
10:23:07 | * | pafmaf joined #nim |
10:38:20 | * | brechtm joined #nim |
10:39:00 | * | brechtm quit (Read error: Connection reset by peer) |
10:39:06 | * | brechtm_ joined #nim |
10:41:53 | * | brechtm__ quit (Ping timeout: 265 seconds) |
10:43:38 | * | samuell quit (Quit: Hejdå) |
10:44:06 | * | brechtm joined #nim |
10:47:15 | * | Snircle joined #nim |
10:47:25 | * | brechtm_ quit (Ping timeout: 255 seconds) |
10:52:40 | * | foocraft joined #nim |
10:54:49 | * | GangstaCat joined #nim |
11:06:47 | * | planhths joined #nim |
11:12:27 | * | foocraft quit (Remote host closed the connection) |
11:16:17 | * | krux02 joined #nim |
11:16:48 | * | arnetheduck joined #nim |
11:19:58 | * | Arrrr quit (Quit: WeeChat 1.5) |
11:21:56 | * | bjz_ joined #nim |
11:21:57 | * | bjz quit (Ping timeout: 276 seconds) |
11:30:34 | * | csoriano quit (Quit: csoriano) |
11:45:44 | * | dddddd joined #nim |
11:46:39 | * | chemist69 quit (Ping timeout: 265 seconds) |
11:47:02 | * | chemist69 joined #nim |
11:47:44 | * | PMunch joined #nim |
11:50:33 | krux02 | what is the proper way to get 32 random bits as uint32? |
11:51:01 | * | dddddd quit (Read error: Connection reset by peer) |
11:51:05 | krux02 | this one does not compile: random.random[uint32](low(uint32) .. high(uint32)) |
11:51:30 | ftsf | krux02, you could just cast an int to uint32 |
11:51:46 | ftsf | but your randomness might be off |
11:51:57 | krux02 | it's important in this case |
11:52:35 | krux02 | I am implementing a gaussian random number generator |
11:55:38 | krux02 | not even this compiles: random.random[int32](low(int32) .. high(int32)) |
11:56:11 | ftsf | http://nim-lang.org/docs/random.html#random,int |
11:56:24 | ftsf | random takes an int: max |
11:56:30 | ftsf | and return in 0..max-1 |
11:56:55 | ftsf | random.random(uint32.high.int).uint32 |
11:57:43 | ftsf | can test if that gives you a nice distribution or not |
11:58:23 | krux02 | ftsf: yes random takes an int, but int can be int32 on 32 bit platforms |
11:58:38 | krux02 | meaning I would kill 32 bit compatibility |
11:58:50 | * | brechtm quit (Remote host closed the connection) |
11:59:21 | ftsf | krux02, well you can always implement your own rng |
11:59:28 | * | brechtm joined #nim |
11:59:34 | ftsf | or modify the stdlib one |
11:59:36 | krux02 | guess what I am doing at the moment |
12:00:13 | krux02 | I was missing a gaussian distribution, and wanted to write one that I might add as a pull request. |
12:00:47 | krux02 | but it turns out that stdlib random is not well thought through at all. |
12:01:27 | krux02 | I think I have to call random twice to get 32 random bits |
12:02:07 | BlaXpirit | krux02, heh yeah, seems so. cast[uint32](next(state)) would work but it's not public |
12:02:22 | BlaXpirit | and yes, gaussian distribution may be too advanced for standard library |
12:02:26 | BlaXpirit | shameless plug https://github.com/BlaXpirit/nim-random#random-integers |
12:03:55 | * | dddddd joined #nim |
12:11:07 | * | fredrik92 quit (Quit: Shutting down...) |
12:12:34 | FromGitter | <endragor> @krux02 you could also consider using `mersenne` module. it returns random `uint32` |
12:15:49 | * | PMunch quit (Quit: leaving) |
12:16:41 | krux02 | endragor: thank you I will give it a try |
12:17:19 | krux02 | the random module even exposes a uint64 as ui but doesn't use it at all in the api |
12:19:48 | krux02 | I dind't know there was mersenne twister, normally when there is one it is in the random module |
12:20:05 | BlaXpirit | krux02, there was no random module in the past |
12:20:46 | krux02 | but who wrote it, it has lot's of design crimes |
12:21:22 | krux02 | the random module should by default use the merenne twister |
12:21:55 | BlaXpirit | krux02, uhm people argue that mersenne twister is outdated |
12:22:03 | BlaXpirit | krux02, earlier question https://github.com/nim-lang/Nim/commits/master/lib/pure/random.nim |
12:22:35 | BlaXpirit | my random module uses mersenne twister by default though :p |
12:24:41 | krux02 | I am not an export I don't know the details of MT, but I never heared any complains about it, it even got into the c++ standard |
12:25:02 | BlaXpirit | krux02, among so many other things though |
12:26:05 | krux02 | ok it's not a good argument to say something is good because it is in the c++ standard, but I think the things added recently for c++ are actually really improving on the language |
12:26:28 | krux02 | but that's another topic on it's own |
12:40:42 | * | planhths quit (Ping timeout: 265 seconds) |
12:52:06 | arnetheduck | Araq, want a patch that kills off endb too? |
12:53:17 | * | planhths joined #nim |
12:59:39 | krux02 | endragor: thanks for your hint to mersenne module, it now works entirely on it, and the dependency to `random` is removed |
12:59:59 | * | pie_ joined #nim |
13:00:42 | * | pie_ quit (Changing host) |
13:00:42 | * | pie_ joined #nim |
13:06:05 | * | xet7_ joined #nim |
13:06:22 | * | PMunch joined #nim |
13:09:48 | * | xet7 joined #nim |
13:13:40 | * | fredrik92 joined #nim |
13:19:04 | * | dddddd quit (Ping timeout: 255 seconds) |
13:22:40 | * | fredrik92 quit (Quit: changing host) |
13:23:05 | * | fredrik92 joined #nim |
13:25:08 | * | xet7 quit (Ping timeout: 244 seconds) |
13:25:08 | * | yglukhov quit (Ping timeout: 244 seconds) |
13:25:26 | * | xet7 joined #nim |
13:25:43 | * | yglukhov joined #nim |
13:26:17 | * | mcc joined #nim |
13:32:31 | * | dddddd joined #nim |
13:37:36 | mcc | Is it possible to make a macro that "looks like" an object? |
13:38:01 | mcc | I want to set it up so that if you call gl.someFunction() it gets translated to glSomeFunction() automatically |
13:39:23 | mcc | It looks like there are macro hooks for trapping MACRONAME( args ) called like a function, MACRONAME:\r\tblock called like a statement, and invoking a macro on something with a pragma |
13:39:43 | mcc | But it doesn't seem like there's anywhere to hook in a macro that looks like MACRONAME.etc |
13:40:38 | mcc | Maybe a macro is not the best way to do this. |
13:43:24 | * | stisa joined #nim |
13:43:26 | mcc | It lets me do: macro `gl.`*(x: expr): expr = x |
13:43:39 | FromGitter | <vendethiel> why do you want a macro? |
13:43:50 | FromGitter | <vendethiel> why not just forward the arguments? Sounds like FFI wrapping 101 |
13:44:27 | mcc | however this has no effect, gl.q just says "gl not found" |
13:44:42 | yglukhov | mcc: i don't have an answer to your question, but there are portble_gl bindings in nimx, that work in js and natively with zero runtime cost. https://github.com/yglukhov/nimx/blob/master/nimx/portable_gl.nim |
13:46:07 | flyx | mcc: you *can* build a macro that does this, but it is probably not as versatile as you think it is, because the compiler must be able to recognize `gl` as some known identifier |
13:47:24 | flyx | mcc: see https://gist.github.com/flyx/57c538646826ef2801b948dbfbb17a64 |
13:48:15 | BlaXpirit | flyx, but can it be done automatically for gl.anything ? |
13:48:20 | mcc | vendethiel: I am trying to set something up where I can write code which is unified between opengl and javascript. currently i'm generating the gl function calls on the js side from a script that looks at the es2015 definition and using the opengl module on the native side. the js code generates so that things look like gl.clearColor(). The opengl module of |
13:48:20 | mcc | course exports glClearColor(). so I'm trying to figure out how to get something in scope that syntactically looks like an object named `gl`, but which forwards any method calls on it to just calling the glClearColor() function in the opengl module or getting the GL_WHATEVER_WHATEVER constant. |
13:48:43 | mcc | vendethiel: So ok, I'm FFI wrapping, but I don't know how to wrap things in Nim, I assumed you did that in the macro layer |
13:48:52 | mcc | glukhov: oh, that is interesting, maybe I shuold just be using that. |
13:49:01 | flyx | BlaXpirit: no, that's what I meant by „not as versatile as you think“ |
13:49:44 | BlaXpirit | what about these http://nim-lang.org/docs/manual.html#special-operators-dot-operators |
13:50:21 | mcc | Another possibility is if I could do something that at compile-time analyzes the opengl module and generates wrappers for everything exported by it |
13:51:09 | FromGitter | <vendethiel> @mcc I'd say you wrap it with functions, as usual |
13:51:15 | flyx | BlaXpirit: well either it doesn't work with a macro, or it does work, in which case *every* dot expression that is not resolvable otherwise will suddenly get piped into that macro |
13:51:26 | BlaXpirit | good point |
13:51:43 | mcc | I think the dot operators would work, but the function name gets converted to a string, whereas i want to resolve it to a symbol |
13:52:05 | mcc | vendethiel: Is it possible to do this without either writing out all the wrapper functions by hand, or running a script external to nim? |
13:53:18 | * | PMunch quit (Quit: leaving) |
13:53:38 | * | PMunch joined #nim |
13:54:28 | mcc | There's some thing called nimSl which is able to analyze a function at compile time and spit out a string, so one assumes you could do the same thing to a module |
13:54:55 | flyx | BlaXpirit: also, the dot notation does not cover gl.someFunction(foo), it would need to be written as (gl.someFunction)(foo) |
13:55:08 | ftsf | \o/ just made a subtractive synth in nim :3 |
13:55:58 | flyx | mcc: a proc is a part of the Nim syntax tree, a module is not |
13:56:01 | mcc | ftsf: cool |
13:56:22 | flyx | well, afaik |
13:57:25 | ftsf | good thing i don't have housemates anymore =) |
13:57:33 | FromGitter | <vendethiel> @mcc: yeah, you could write a macro to generate those calls :) |
13:58:36 | flyx | getType() on a module name returns "void" |
13:59:16 | * | gunn_ quit (Ping timeout: 264 seconds) |
14:02:09 | * | gunn joined #nim |
14:03:01 | mcc | flyx: my reading is that .() can catch gl.someFunction(x) , however, again, then i'd have to interpret a string at runtime, which is a cost |
14:03:42 | * | fredrik92 quit (Quit: Leaving.) |
14:06:18 | mcc | I guess it seems sorta weird I can totally do a macro that converts %.symbolname to glSymbolName, but I can't do a macro that converts gl.symbolname to glSymbolName |
14:09:31 | def- | mcc: can't the string interpretation be done at compile time? at least the information is known at compile time, so "when" or a macro should work |
14:09:31 | Araq | you cannot figure out to use newIdentNode? |
14:10:44 | flyx | mcc: okay, this works: https://gist.github.com/flyx/37306d3e1dc2bec63987d5f93b2f3704 |
14:10:48 | flyx | but I consider it bad code |
14:11:07 | mcc | ohhh... |
14:11:23 | mcc | i didn't realize .() could be a macro. Hm. |
14:11:44 | def- | but "when" instead of "if" should be simpler if it works |
14:13:41 | flyx | the problem is that it catches everything. if `a` is some variable, `a.foo()` will print "Some useful error message here" |
14:13:54 | flyx | so you basically override the compiler messages for unresolvable fields |
14:14:00 | mcc | araq: Is it weird that "macro `%.`*(x: expr): expr = x" works, but "macro `%gl.`*(x: expr): expr = x" silently does nothing? If I do the latter %gl.q is just an error message ("% not defined"). I mean, if macro `` can't include alphanumerics in this fashion that is fine, but maybe it should emit an error message rather than failing silently |
14:14:36 | mcc | flyx: oh. i see :/ |
14:15:12 | def- | what about making a module gl, "import nil from gl", and then you can use someFunction() as gl.someFunction()? |
14:15:50 | mcc | araq: newIdentNode seems straightforward enough, what I cannot figure out how to do at the moment is how to trap the gl.whatever() call into the macro processor in the first place so that i have the opportunity to call newIdentNode. |
14:16:15 | mcc | araq: if i could at compile time browse over the contents of the opengl module and generate "bindings" at that poin that would also solve my problem, but it's not clear if that's possible |
14:16:41 | Araq | type DotType = distinct int |
14:16:48 | Araq | var gl: DotType |
14:17:05 | Araq | macro `.`(x: DotType; y: untyped) ... |
14:17:50 | Araq | about the "silently does nothing": No, it's not weird, it's your misunderstanding of what backticks do |
14:18:08 | mcc | def-: I still have to populate the module with something. I could use yglukhov's nimx.portable_gl for this but there's some philosophical advantage to the generation of the module being automated (there are a couple symbols missing in portable_gl, i could file pull requests but...) |
14:18:51 | flyx | here, it now restored the error message for other dot expressions: https://gist.github.com/flyx/37306d3e1dc2bec63987d5f93b2f3704 |
14:18:53 | mcc | araq: okay. and that in fact will *not* catch q.whatever where q is something other than DotType? |
14:19:06 | mcc | araq/flyx: thank you so much. |
14:19:49 | * | flyx attaches a large „NOT WELL TESTED // USE WITH CARE“ sticker to that code |
14:20:15 | Araq | mcc: these are all hackish IMO, and you should stick to generating the wrapper code in a more traditional fashion |
14:20:37 | mcc | Araq: What would be a traditional means of generating wrapper code for a Nim module? |
14:20:56 | Araq | c2nim generates Nim source code... |
14:21:11 | Araq | what's wrong with yglukhov's OpenGL thing? |
14:21:34 | hohlerde | struct alignment and golang .... two worlds collide |
14:22:06 | Araq | also I think you should use Emscripten, JS backend + OpenGL, why? the JS backend is for web'y stuff |
14:23:35 | mcc | sorry, i mean: if i want to generate bindings from c, i can use c2nim, if i want to generate bindings from js, i wrote my own script from that, but in this particular situation what i'm curious about is generating a "binding" wrapper for an existing nim module, just to make it look different. i accept this might not be the most reasonable thing to attempt |
14:24:24 | hohlerde | does nim have problems with packed structs? if a lib function returns a packed struct, can I use that in nim or do I have to take care of padding? sorry for the dumb question, I am a C noob. |
14:24:56 | Araq | there is a .packed pragma for that iirc |
14:25:11 | hohlerde | oh, thx for the hint |
14:27:20 | mcc | yglukov's opengl thing is very good, the only downside to it is it is missing a couple things which the opengl module has, so if i want to use random stuff there would be some extra steps to adding things. |
14:28:17 | Araq | add the things. |
14:30:02 | * | okami quit (Quit: 1.5) |
14:31:57 | mcc | araq: I'm avoiding using emscripten because my understanding is it produces fairly bloated output files (in part because it embeds its own libc, etc, i believe?) and also my understanding is it's pretty difficult to interact directly with js libraries from in there. the webgl app i've written (and am now trying to backport to desktop) uses both webgl and a |
14:31:57 | mcc | webaudio library called tone.js |
14:33:20 | mcc | araq: on the nimx thing i have no defense and i probably will start merging my approach with nimx at some point :O |
14:34:34 | * | xet7 quit (Quit: Leaving) |
14:36:01 | * | okami joined #nim |
14:36:35 | * | okami quit (Client Quit) |
14:47:50 | hohlerde | am I right that single byte alignment for C structs and the packed pragma are basically the same? |
14:50:53 | mcc | hohlerde: the definition in the manual certainly seems to say so http://nim-lang.org/docs/manual.html#foreign-function-interface-packed-pragma |
14:55:42 | * | themagician quit (Ping timeout: 244 seconds) |
14:56:07 | hohlerde | mcc: I agree, but I was a bit uncertain. On the other hand that means if a library uses 2 byte struct alignment, I am out of luck and need to emit boilerplate code to handle that special alignment. |
14:57:05 | mcc | If you need 2 byte struct alignment, I assume the normal way to do this would be to insert padding members. |
14:57:25 | mcc | Also are we talking about 2 byte alignment for fields or 2 byte alignment for the whole structure? |
14:58:45 | hohlerde | the lib uses in its header file #pragma pack(push,2) at the beginning and #pragma pack(pop) at the end |
14:59:37 | Araq | is this DOS code? |
15:00:07 | Araq | 2 byte alignment is kinda like 6 bit bytes |
15:01:06 | hohlerde | nope, its running under linux and windows and comes from an ATM manufacturer. the include files are weird. one uses 1 byte alignment and the other 2 byte alignment |
15:02:16 | hohlerde | the first lib version was released in 2007 |
15:04:04 | hohlerde | I am currently not sure how to handle 2 byte alignment in a nim wrapper for that lib :-) never did something like manually adding padding bytes. |
15:07:38 | * | elrood joined #nim |
15:08:07 | mcc | hohlerde: unless you try to modify the .packed pragma in nim's code, it would just mean editing the nim versions of the structs and inserting uint8 members as appropriate |
15:08:25 | hohlerde | yes |
15:08:27 | mcc | hohlerde: will involve doing some math in your head tho |
15:08:54 | hohlerde | and a lot, because the lib uses a lot of (nested) structs |
15:15:48 | planhths | Hi, could the syntax ` 'a' not in {'a', 'b', 'c'} ` exist in nim? |
15:16:52 | krux02 | planhths: whats so bad about not 'a' in {...}? |
15:17:18 | planhths | I though it wasn't compiling |
15:17:35 | planhths | krux02: let me check again |
15:17:56 | mcc | Okay, so granted that this macro . thing i am doing may not be the best way to do this and I'm trying to understand nim macros at this point-- |
15:18:21 | mcc | "Warning: overloaded '.' and '()' operators are now .experimental; . is deprecated [Deprecated]" <-- is this surprising? am i doing something wrong / should i be doing something different? |
15:18:49 | BlaXpirit | mcc, probably should accept the absence of namespaces |
15:18:53 | mcc | I get this when I try to compile macro `.` or macro `.()`. This is with last week's git devel |
15:18:54 | planhths | yes it says "Error: type mismatch: got (char) but expected one of ..." |
15:18:54 | krux02 | planhths, ok I am surprised it isn't compiling |
15:19:22 | mcc | blaxpirit: sorry, namespaces? |
15:20:07 | BlaXpirit | mcc, why do you want to introduce this fake dot if it changes very little? |
15:20:16 | krux02 | planhths, 'a' notin {'a', 'b', 'c'} works for me |
15:20:49 | planhths | krux02: ok thanks |
15:21:24 | mcc | blaxpirit: i am trying to bridge two dissimilar APIs without manually writing a bunch of bindings. as discussed above, the advice from this channel is that i should be instead be using manually written bindings (the nimx approach) |
15:21:25 | krux02 | but it's weird, that not ('a' notin {'a', 'b', 'c'}) doesn't work |
15:22:58 | planhths | not ('a' notin {'a', 'b', 'c'}) works but " not a' notin {'a', 'b', 'c'}" doesn't |
15:23:19 | planhths | *not 'a' in {'a', 'b', 'c'} |
15:24:41 | krux02 | maybe you can write an expression macro for this ;) |
15:26:29 | planhths | maybe... |
15:34:52 | Araq | unary operators bind stronger than binary ops |
15:40:50 | * | planhths quit (Ping timeout: 258 seconds) |
15:43:15 | * | planhths joined #nim |
15:43:44 | * | reactormonk_ joined #nim |
15:44:01 | * | pafmaf quit (Ping timeout: 250 seconds) |
15:44:55 | * | yglukhov_ joined #nim |
15:45:30 | * | sarlalian joined #nim |
15:46:20 | * | arnetheduck quit (Ping timeout: 244 seconds) |
15:48:54 | * | reactormonk quit (Quit: WeeChat 1.5) |
15:48:55 | * | CARAM__ quit (Ping timeout: 260 seconds) |
15:48:55 | * | zielmicha quit (Ping timeout: 260 seconds) |
15:48:58 | * | EastByte quit (Ping timeout: 260 seconds) |
15:48:59 | * | krux02 quit (Ping timeout: 260 seconds) |
15:48:59 | * | mtj_ quit (Ping timeout: 260 seconds) |
15:48:59 | * | ofelas quit (Ping timeout: 260 seconds) |
15:49:00 | * | kier quit (Ping timeout: 260 seconds) |
15:49:00 | * | vktec quit (Ping timeout: 260 seconds) |
15:49:01 | * | JStoker quit (Ping timeout: 260 seconds) |
15:49:01 | * | RushPL quit (Ping timeout: 260 seconds) |
15:49:01 | * | abruanese quit (Ping timeout: 260 seconds) |
15:49:02 | * | sarlalian_ quit (Ping timeout: 260 seconds) |
15:49:02 | * | yglukhov quit (Ping timeout: 260 seconds) |
15:49:09 | * | abruanese joined #nim |
15:49:11 | * | krux02 joined #nim |
15:49:16 | * | RushPL joined #nim |
15:49:34 | * | ofelas joined #nim |
15:50:13 | * | mtj_ joined #nim |
15:51:08 | * | kier joined #nim |
15:53:45 | * | planhths quit (Ping timeout: 244 seconds) |
15:54:38 | * | zielmicha joined #nim |
15:55:06 | * | JStoker joined #nim |
15:55:43 | * | okami joined #nim |
15:56:07 | * | CARAM__ joined #nim |
15:57:44 | * | PMunch quit (Quit: leaving) |
15:59:15 | * | EastByte joined #nim |
15:59:36 | * | vktec joined #nim |
16:00:58 | * | Andris_zbx quit (Remote host closed the connection) |
16:28:38 | * | planhths joined #nim |
16:29:38 | * | nsf quit (Quit: WeeChat 1.5) |
16:29:47 | flyx | if I have a file named like some stdlib module, how can I import the stdlib module instead? for example, I have a streams.nim in my directory and want to import stdlib's streams |
16:34:50 | dom96 | I don't think you can currently |
16:34:56 | dom96 | There is an open issue about this somewhere |
16:37:32 | * | yglukhov_ quit (Ping timeout: 265 seconds) |
16:42:29 | * | Demon_Fox joined #nim |
16:42:36 | ftsf | http://static.impbox.net/synth.mp4 \o/ nim synth is sounding synthy. so easy to prototype stuff in nim. |
16:44:53 | * | brechtm_ joined #nim |
16:45:43 | Araq | flyx: import "$lib/pure/streams" |
16:46:03 | Araq | there is an issue because of the 'pure' part but it will continue to work |
16:48:28 | * | brechtm quit (Ping timeout: 264 seconds) |
16:48:46 | dom96 | ftsf: firefox says the file is corrupt |
16:49:30 | ftsf | dom96, =( making video compatible for all browsers is hard. |
16:50:20 | dom96 | works in Chrome, ooooh |
16:51:09 | dom96 | ftsf: is this all written in Nim? |
16:51:13 | ftsf | dom96, yeah |
16:51:19 | dom96 | awesome! |
16:51:25 | dom96 | got the source up anywhere? |
16:51:29 | ftsf | SDL for graphics and audio, although I'd like to port it to use JACK |
16:51:42 | ftsf | not yet, but i'll put it up once it's cleaned up a bit |
16:51:48 | cheatfate | flyx, i think when you `import streams` you will get stdlib's streams |
16:51:54 | cheatfate | not yours |
16:52:13 | ftsf | i'd like to make a little music studio thing, simple synths and sequencer |
16:57:13 | flyx | cheatfate: I got mine, not the stdlib's, but I solved it by renaming my file now |
16:58:34 | cheatfate | Araq, i thought if i have local version of `somemodule.nim` and stdlib has same module `somemodule.nim`, then if i'm using `import somemodule` - stdlib's module must be imported not my local version, am i wrong? |
16:58:49 | mcc | ftsf: that is a really good sound :O |
17:01:28 | ftsf | mcc, thanks! still learning this stuff, but it's coming together |
17:01:59 | * | pafmaf joined #nim |
17:11:06 | * | okami quit (Quit: 1.5) |
17:11:16 | * | okami joined #nim |
17:11:42 | * | nairobi joined #nim |
17:18:28 | * | dddddd quit (Ping timeout: 244 seconds) |
17:21:00 | * | yglukhov joined #nim |
17:25:12 | * | yglukhov quit (Ping timeout: 244 seconds) |
17:29:00 | mcc | flyx: so-- granted that there seems to be a consensus in here that it is not a very good idea to actually use that macro code you pasted-- |
17:30:31 | mcc | --wait, n/m, figured it out |
17:31:18 | * | dddddd joined #nim |
17:38:40 | * | xet7 joined #nim |
17:41:42 | * | perturbation joined #nim |
17:43:21 | mcc | ...ok, yeah. so I modified flyx's .() macro in an attempt to make a version that could be used for constants: https://gist.github.com/mcclure/efbb3f564b8c6447f2400ac656913dbe however, when i run it, i get: Error: value of type 'int' has to be discarded |
17:43:44 | mcc | If I change it from "let glSomeVar" to "const glSomeVar" it says that a literal(4) has to be discarded. Am I missing something here? |
17:45:17 | mcc | It seems to be wanting to treat the ast fragment returned by the macro, in this one case, as a statement rather than a n expression |
17:47:18 | Araq | mcc: use 'untyped' as the return type of the macro. known bug. |
17:47:32 | mcc | ok, thanks |
17:47:38 | Araq | cheatfate: actually local files override stdlib files |
17:47:46 | * | Jesin joined #nim |
17:47:47 | Araq | otherwise we couldn't add new modules to the stdlib. |
17:56:45 | flyx | I get a strange error with my code here: https://gist.github.com/flyx/f827fbf10d2da4e2fd1bf27809716276 |
17:57:25 | flyx | what does `invalid type: 'None'` mean? I have given all types |
17:57:43 | flyx | it even tells me in the error message that the generic type has a proper parameter |
17:58:13 | Araq | try without ': SourceProvider' |
17:58:54 | flyx | hmm, that works |
17:59:28 | flyx | but I do need SourceProvider |
18:01:27 | mcc | It is normal that macros are recursively available inside themselves, right? Like when I tried making a macro `.`, it was trying to apply macro `.` when I used . inside the macro |
18:02:20 | * | yglukhov joined #nim |
18:04:09 | flyx | interestingly, it works when I give [T: BaseLexer] to newYamlLexer explicitly and return YamlLexer[T] |
18:04:37 | * | krux02 quit (Remote host closed the connection) |
18:09:06 | * | yglukhov quit (Remote host closed the connection) |
18:13:24 | * | chemist69 quit (Ping timeout: 258 seconds) |
18:15:38 | * | Senketsu quit (Quit: Leaving) |
18:15:48 | * | chemist69 joined #nim |
18:18:45 | * | csoriano joined #nim |
18:21:28 | * | pafmaf quit (Ping timeout: 264 seconds) |
18:44:54 | * | yglukhov joined #nim |
18:47:54 | * | kulelu88 joined #nim |
19:12:08 | * | Mat4 joined #nim |
19:13:24 | * | Mat4 left #nim (#nim) |
19:14:42 | * | planhths quit (Ping timeout: 265 seconds) |
19:22:21 | * | pafmaf joined #nim |
19:25:37 | * | Matthias247 joined #nim |
19:28:00 | * | krux02 joined #nim |
19:34:19 | * | planhths joined #nim |
19:35:26 | * | nsf joined #nim |
19:48:33 | * | nairobi quit (Remote host closed the connection) |
19:52:27 | * | planhths quit (Ping timeout: 244 seconds) |
20:01:22 | * | stisa_ joined #nim |
20:03:42 | * | gokr1 joined #nim |
20:05:59 | * | stisa_ quit (Client Quit) |
20:10:13 | * | xet7 quit (*.net *.split) |
20:10:13 | * | EastByte quit (*.net *.split) |
20:10:13 | * | mtj_ quit (*.net *.split) |
20:10:13 | * | stisa quit (*.net *.split) |
20:10:14 | * | pie_ quit (*.net *.split) |
20:10:14 | * | gokr quit (*.net *.split) |
20:10:14 | * | alexsystemf___ quit (*.net *.split) |
20:10:14 | * | namnguyen quit (*.net *.split) |
20:10:14 | * | derlafff quit (*.net *.split) |
20:10:15 | * | jonafato quit (*.net *.split) |
20:10:41 | * | jonafato joined #nim |
20:11:52 | * | EastByte joined #nim |
20:11:53 | * | alexsystemf___ joined #nim |
20:11:53 | * | namnguyen joined #nim |
20:11:53 | * | derlafff joined #nim |
20:12:20 | * | pie_ joined #nim |
20:12:21 | * | xet7 joined #nim |
20:12:21 | * | alexsystemf___ quit (Max SendQ exceeded) |
20:12:48 | * | mtj_ joined #nim |
20:13:13 | * | alexsystemf___ joined #nim |
20:16:36 | * | pie_ quit (Changing host) |
20:16:37 | * | pie_ joined #nim |
20:18:47 | * | yglukhov quit (Remote host closed the connection) |
20:23:45 | * | rtr_ joined #nim |
20:30:02 | * | GangstaCat quit (Quit: Leaving) |
20:36:28 | * | fredrik92 joined #nim |
20:36:53 | * | dddddd quit (Read error: Connection reset by peer) |
20:39:22 | * | dddddd joined #nim |
20:40:51 | * | reactormonk_ is now known as reactormonk |
20:59:58 | * | Ven_ joined #nim |
21:13:51 | * | fredrik92 quit (Quit: Leaving.) |
21:14:08 | * | csoriano quit (Read error: Connection reset by peer) |
21:14:13 | * | fredrik92 joined #nim |
21:16:15 | * | csoriano joined #nim |
21:27:10 | * | csoriano quit (Quit: csoriano) |
21:28:23 | * | Trustable quit (Remote host closed the connection) |
21:30:58 | * | fredrik92 quit (Quit: Leaving.) |
21:31:28 | * | fredrik92 joined #nim |
21:44:17 | * | fredrik92 quit (Quit: Leaving.) |
21:44:41 | * | fredrik92 joined #nim |
21:45:02 | * | fredrik92 quit (Client Quit) |
21:46:27 | * | fredrik92 joined #nim |
21:46:41 | * | fredrik92 quit (Client Quit) |
21:47:47 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:49:19 | mcc | OK, so, I am confused by when and why the javascript export chooses to turn types into TypedArrays |
21:49:20 | * | fredrik92 joined #nim |
21:49:47 | mcc | If i compile this code with js: `var a {.exportc.} : array[4, float32] ; var b {.exportc.} : array[1, array[4, float32]]` "a" becomes an Array with 4 elements, and "b" becomes an Array containing 1 element which is a Float32Array with 4 elements. |
21:49:51 | mcc | Why? |
22:03:44 | * | rtr_ quit (Remote host closed the connection) |
22:05:25 | * | rtr_ joined #nim |
22:07:04 | * | pafmaf quit (Ping timeout: 264 seconds) |
22:09:53 | * | rtr_ quit (Ping timeout: 244 seconds) |
22:26:19 | * | nairobi joined #nim |
22:40:11 | * | nairobi quit (Remote host closed the connection) |
22:48:59 | * | xet7 quit (Read error: Connection reset by peer) |
22:49:45 | * | xet7 joined #nim |
23:12:41 | * | elrood quit (Quit: Leaving) |
23:19:34 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:21:24 | * | xet7 quit (Read error: Connection reset by peer) |
23:21:49 | * | xet7 joined #nim |
23:25:26 | * | perturbation quit (Quit: Leaving) |
23:30:14 | * | bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
23:31:17 | * | gunn_ joined #nim |
23:32:40 | * | brson joined #nim |
23:33:54 | * | brechtm_ quit (Read error: Connection reset by peer) |
23:34:00 | * | brechtm joined #nim |
23:34:48 | * | xet7_ quit (Remote host closed the connection) |
23:35:09 | * | gunn quit (Ping timeout: 276 seconds) |
23:36:18 | * | PMunch joined #nim |
23:39:33 | * | xet7 quit (Read error: Connection reset by peer) |