<< 29-07-2014 >>

00:11:13flaviuWow, it looks like the json module doesn't have any noticeable bugs
00:13:11*mwbrown joined #nimrod
00:20:39flaviuA little memory problem though, lol
00:22:54*brson quit (Quit: leaving)
00:26:22*Jesin joined #nimrod
00:44:28*Jesin quit (Quit: rebooting)
00:51:58*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
00:53:48*xenagi joined #nimrod
01:12:50*ics joined #nimrod
01:34:43*q66 quit (Quit: Leaving)
01:39:04darkfso, stupid question: when I install a library package with babel, how do I import one of the modules? e.g. I'm trying to imoprt https://github.com/fowlmouth/horde3d/blob/master/src/h3d.nim with import h3d but cannot open 'h3d'
01:39:47flaviuSo you've done `babel install horde3d`?
01:40:19*Jesin joined #nimrod
01:40:52darkfyup
01:41:10darkfnimrod hints that it adds the .babel\pkgs\horde3d-1.0 path too
01:41:36flaviujust a guess, does src.h3d work?
01:41:48flaviualso try horde3d.h3d
01:42:21darkfheh, src.h3d works but Error: cannot open 'importc_block'
01:42:35darkfthere don't seem to be docs for that lib
01:42:49*Jessin joined #nimrod
01:43:47adoniscikit's in https://github.com/fowlmouth/nimlibs
01:44:55flaviuYep, also make an issue on fowl's horde3d repo. That's a bug, he needs to add a dependency or something.
01:46:04flaviuActually, it looks like that's a dead import
01:46:12flaviujust delete it
01:46:44*Jesin quit (Ping timeout: 260 seconds)
01:46:54darkfhuh, so it is, heh
01:46:57darkfthanks a lot
01:46:58*Jessin is now known as Jesin
01:47:37darkf(well, it might just be that the macro defined there automatically applies to the procs without needing to be called)
01:48:21flaviuIt needs to be called to be run, Nimrod doesn't support custom compiler passes or similar.
01:49:15darkfah, okay
01:57:50darkfhrm, the dynlib pragma works on Windows, right? if I try to run it: could not load: libHorde3D.dll evne though it's in the same directory
02:00:04flaviushared libraries are always ... fun
02:00:05flaviuI think you have to pass something to the compiler, give me a few seconds
02:00:20darkfhaha :)
02:02:02*Jesin quit (Quit: Leaving)
02:02:04flaviutry --dynlibOverride:Horde3d --passL:libHorde3D.dll
02:02:13flaviuand also try putting it in the nimcache folder
02:05:00darkfhrm, yeah... I have to use --cpu:i386 to make it work with the x86 .dll; of course this causes:
02:05:01darkfc:\Program Files (x86)\Nimrod\lib/nimbase.h:382:13: error: size of array 'assert_numbits' is negative typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
02:05:19flaviuAre you using 32 bit gcc?
02:05:29flaviuor whatever your favorite compiler is?
02:05:35fowldarkf, i will make you a collaborator so you can push updates, what is your github username
02:05:49darkffowl: darkf
02:06:20darkfflaviu: I'm not sure if gcc itself is 64-bit; I believe it does output 64-bit programs without -m32
02:06:42fowldarkf, cool, thank you :)
02:07:04darkf(I'm also not sure if it's using my gcc or Nimrod's distributed versio)
02:07:12darkffowl: thanks
02:07:29flaviudarkf: try --passC:-m32
02:08:10flaviudocs are at http://nimrod-lang.org/nimrodc.html if you haven't found them. They aren't very accessible
02:10:23darkfhrm: c:/program files (x86)/nimrod/dist/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `c:\users\bak\desktop\nim\nimcache\blah.o' is incompatible with i386:x86-64 output
02:10:27darkfthat's with --cpu:i386
02:10:33mwbrownHas anyone here had any luck running Nimrod on an embedded system? I'm thinking of doing it on an ARM Cortex M3
02:11:00mwbrownalso, apparently the 16-bit "AVR" cpu type doesn't work. Gives some complaint in system.nim about type matching last time I checked
02:11:16flaviumwbrown: I've run it on MIPS qemu, and at one point raspberry pi was used as a testing platform
02:11:35flaviuARM should work great
02:12:05mwbrownI was thinking of getting some quick and dirty setup that just boots the chip and jumps into the Nimrod main function
02:12:14mwbrownor whatever its equivalent is when you compile a nimrod program
02:12:26mwbrownany docs on calling nimrod from C?
02:12:44flaviumwbrown: its easy, just use the C sources
02:13:17flaviuNot much to it, nimrod is C as far as interop is concerned
02:13:32mwbrownwhat about function naming? Does nimrod mangle names at all?
02:13:38flaviuI think you have to gc_ref/gc_unref sometimes, but that shouldn't matter
02:13:56flaviumwbrown: Yeah, it does, but there's an exportc pragma
02:14:03mwbrownah
02:48:07*Boscop quit (Read error: Connection reset by peer)
02:48:57*Boscop joined #nimrod
03:05:06*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
03:33:13*MayurYa quit (Quit: *nix server crashed w/ bof)
03:53:13mwbrownflaviu: you still active?
03:53:27flaviuyep, going to bed soon though
03:53:30mwbrownalright
03:53:32mwbrownquick question though
03:53:36flaviuNot for ~20 min though
03:53:42flaviusure, what question?
03:53:53mwbrowndo you know what the --cpu:SYMBOL thing affects when you set to say ARM vs i386?
03:54:09mwbrownobviously the biggest difference is what GCC you use to compile it with, since Nimrod only goes to C
03:54:22flaviuI think it also changes the int size
03:54:39mwbrownbecause there's a big difference between an ARM Cortex A8 vs. a Cortex M3
03:54:47mwbrownbut when it comes to data types, they're the same size and endianness
03:55:35mwbrownI think I might be able to get this program to work as a single nim file if I compile it right. libopencm3 already provides startup files and interrupt vectors built into the lib
03:55:57mwbrowni.e. no assembly or helper C file required
03:56:31flaviuHave you tried running it on the chip?
03:56:50mwbrownhaven't gotten it fully compiled yet. I need to link it with opencm3 with the right linker script for that to work
03:56:56flaviuI don't really understand what you're trying to do
03:57:10mwbrownJust trying to get it to compile and run on a small ARM Cortex M3
03:57:14mwbrownsomething like an STM32F3
03:57:25mwbrown48k of RAM ;)
04:00:16flaviumwbrown: https://github.com/Araq/Nimrod/blob/devel/compiler/platform.nim tells you what the --cpu:SYMBOL does
04:01:15mwbrownah, ok. It just sets up the basics for compile-time asserts it looks like
04:03:08*ics joined #nimrod
04:04:24*xenagi quit (Quit: Leaving)
04:09:27*saml_ quit (Ping timeout: 245 seconds)
04:11:43mwbrownNow I just have to find a way to get it to not pass in -ldl to the linker. Either that or just pass --noLinking and handle the link step myself
04:11:47mwbrownhonestly that might just be simpler
04:58:24*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
04:59:26*Matthias247 joined #nimrod
05:07:10*superfunc joined #nimrod
05:08:06*Demos quit (Quit: Leaving)
05:16:05*Matthias247 quit (Read error: Connection reset by peer)
05:16:28*flaviu quit (Ping timeout: 255 seconds)
05:43:20*MayurYa joined #nimrod
05:43:28*MayurYa quit (Changing host)
05:43:28*MayurYa joined #nimrod
05:54:35*mwbrown quit (Ping timeout: 255 seconds)
06:00:33*CARAM_ quit (Read error: Connection reset by peer)
06:05:48*CARAM_ joined #nimrod
06:06:58adoniscikis it possible to disable specific warnings in specific files?
06:09:00adoniscikyep, with {.warning.}. man I love this language
06:12:17*superfunc quit (Ping timeout: 245 seconds)
06:18:41*ics joined #nimrod
06:26:02*CARAM_ quit (Ping timeout: 272 seconds)
06:31:17*CARAM_ joined #nimrod
06:36:08*fowl quit (Ping timeout: 250 seconds)
06:37:55*fowl joined #nimrod
06:42:21*kunev joined #nimrod
06:56:20*darkf quit (Ping timeout: 240 seconds)
06:57:25*darkf joined #nimrod
07:01:49adoniscikargh, I just had a rude introduction to matrix ordering. I'm writing a wrapper to a Fortran library so I have to convert between row and column major ordering
07:01:54adoniscikthis can't be good for performance
07:15:00*darkf_ joined #nimrod
07:15:32*darkf quit (Ping timeout: 240 seconds)
07:22:43*kunev quit (Quit: leaving)
07:28:01*kunev joined #nimrod
07:33:23Araqadoniscik: you never know, it can be completely in the noise
07:33:31Araqor it can make a real difference
07:34:12Araqmy guess is "noise" ;-)
07:34:20Araqmodern cpus are very strange
07:34:39adoniscikwhat do you mean, that it doesn't affect performance?
07:36:14adoniscikanother peculiarity of Fortran is all variables are passed by reference, so my wrapper is littered with ptrs. I wish I could use a pragma and apply it to all variables
07:38:15Araqyeah, like .byRef
07:38:41Araqin fact, all arrays are passed by pointers already
07:39:13AraqI mean the *copies* at the language boundaries could be free
07:39:32Araqnot the memory layout doesn't matter for computing, it certainly does
07:40:29Araq"The ``byref`` pragma can be applied to an object or tuple type and instructs
07:40:30Araqthe compiler to pass the type by reference (hidden pointer) to procs."
07:40:32Araqbbl
07:40:48adoniscikyeah, I noticed that bit. great thing about byref, I'm trying it now
07:41:06*darkf_ is now known as darkf
07:42:14adoniscikI meant that bit about arrays by pointers
07:44:13adoniscikjust to be clear, defining T as {.byref.} means I can eliminate an addr/ptr pair?
07:45:12adoniscikwhere T is the type of the arg that needs to be passed by pointer
07:46:20adoniscikfoo(x : T) instead of foo(addr x)
08:09:17*superfunc joined #nimrod
08:13:44*superfunc quit (Ping timeout: 250 seconds)
08:19:50adoniscikg'night ,folks. byref seems not to work with aliased typedefs; e.g., type foo {.byref.} = bar
08:20:26adonisciktalk about it tomorrow...
08:24:53*adoniscik quit (Ping timeout: 240 seconds)
08:41:16*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:48:29*io2 joined #nimrod
09:03:33*Matthias247 joined #nimrod
09:51:36*zahary quit (Ping timeout: 260 seconds)
10:09:27*superfunc joined #nimrod
10:13:37*superfunc quit (Ping timeout: 245 seconds)
11:09:38*gsingh93 quit (Quit: Connection closed for inactivity)
11:28:54*Matthias247 quit (Read error: Connection reset by peer)
12:21:28*saml_ joined #nimrod
12:35:23*untitaker quit (Ping timeout: 264 seconds)
12:39:01*mwbrown joined #nimrod
12:40:13*untitaker joined #nimrod
12:41:05*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
12:52:29*darkf quit (Quit: Leaving)
12:59:40*flaviu joined #nimrod
13:08:11SkrylarAraq: i broke your typechecker :( https://github.com/Araq/Nimrod/issues/1424
13:14:37*saml_ quit (Quit: Leaving)
13:24:20*mwbrown quit (Ping timeout: 250 seconds)
13:32:49flaviuSkrylar: I don't that's a bug. openarrays are defined as a [vals: pointer, len: int], and an array can't be anything but a [vals: pointer]. Cast overrides all the sanity checks.
13:43:53*Trustable joined #nimrod
14:10:30*Boscop_ joined #nimrod
14:11:03*superfunc joined #nimrod
14:13:52*Boscop quit (Ping timeout: 260 seconds)
14:15:34*superfunc quit (Ping timeout: 264 seconds)
14:16:03*Boscop_ quit (Read error: Connection reset by peer)
14:16:29*Boscop_ joined #nimrod
14:48:16*ics joined #nimrod
15:07:47*kunev quit (Quit: leaving)
15:17:13*Demos joined #nimrod
15:33:57*Trustable1 joined #nimrod
15:35:02*Trustable quit (Ping timeout: 240 seconds)
16:05:07*flaviu quit (Read error: Connection reset by peer)
16:07:51*flaviu joined #nimrod
16:12:15*superfunc joined #nimrod
16:14:25*linkmonitor joined #nimrod
16:15:57*othello joined #nimrod
16:16:46*superfunc quit (Ping timeout: 264 seconds)
16:31:04othellohello, sorry to ask a newb question, but I'd like to know how to get the underlying type of sequence?
16:31:16othello*a sequence, sorry
16:32:10othelloe.g. I have a tuple TMyTuple[a: int, b: seq[string], c: string]
16:33:06othelloif I have var test: TMyTuple, and all I can access is test[1] or test.b
16:33:27othellois it possible to retrieve the type string from test[1] or test.b?
16:35:49Demosdoes type(test[1]).name work
16:35:58DemosI think you need the typetraits module for the name function
16:44:04othellothanks, it works! But then is there a way to build a var using that type represented as string?
16:46:11Demosas the var name?
16:46:23*io2 joined #nimrod
16:53:40*brson joined #nimrod
16:55:11*Matthias247 joined #nimrod
17:01:54othelloDemos: no using it as the type in a newSeq[T] construct
17:02:17othelloexcept of course, there is a more straightforward way of building the sequence in the first place
17:02:26Demoswhy not just do newSeq[type(test[1])]?
17:02:46othellobecause then I get a seq[seq[string]]
17:03:03Demoswell that should not happen
17:03:25Demosoh, erm well yeah
17:03:42Demostest[1] is of type seq[string]
17:03:46Demoswhat type did you want?
17:03:59Demosoh a string
17:04:17othelloexactly
17:04:21Demostry type(test[1][1])
17:04:32DemosI am not sure if the thing in the type is evaluaged, probably not
17:04:43othelloit worked!
17:04:46othellostrange
17:04:56Demosnot really.... this is desired behavior
17:05:18Demosyou could probably say type(test[1][100000]) as well
17:05:29*q66 joined #nimrod
17:05:41othelloyes, but it even worked on an uninitialized variable
17:06:00othelloi.d. var test: TMyTuple
17:06:23othellovar builtSeq = newSeq[type(test[1][1])]()
17:06:40*adoniscik joined #nimrod
17:06:40Demosyeah
17:06:50Demosagain the thing in type() is not evaluated
17:06:54othelloah ok, it's because it's just a type check
17:06:58othellogot it
17:07:36othellothe type proc is evaluated at compile time anyway, right?
17:08:05Demoswell type is a magic
17:08:08Demosbut yeah
17:08:37Demosthere is no way to get the type at runtime unless you store type information someplace (objects that inheret from stuff do this)
17:09:08Demosbe thankfull type((test[1][1])) is the same as type(test[1][1])
17:09:40othellothanks so much for your help & clarifications
17:09:45othellosorry for the bother
17:11:03Demosno bother at all! if we did not want to help out we would not be in this channel
17:19:23*bjz_ joined #nimrod
17:22:17*bjz quit (Ping timeout: 245 seconds)
17:29:01Demoshow much interest is there in a Direct3D 11 wrapper?
17:32:29Araqsounds very good, but an update for the zeromq wrapper is more important
17:32:52Araqsux that we still have outdated wrappers in the stdlib
17:33:39Araqsux even more that people don't know about API design and so need to change everything constantly
17:34:12NimBotAraq/Nimrod devel d9b5ae1 def [+0 ±3 -0]: Allow arguments for "nimrod run"
17:34:12NimBotAraq/Nimrod devel 1274953 def [+0 ±1 -0]: normalize "run" command
17:34:12NimBotAraq/Nimrod devel 4eccfb9 Andreas Rumpf [+0 ±3 -0]: Merge pull request #1422 from def-/nimrod-run2... 2 more lines
17:35:46dom96hi
17:37:42DemosDoes anyone really know about API design, it seems to be a thing that is aquired by experience and wisdom
17:37:51DemosI have a d3d wrapper sitting on github I think
17:38:11Demosor rather bitbucket
17:39:23NimBotAraq/Nimrod devel 2577c92 Joshua Cearley [+0 ±1 -0]: Add better support for unsigned ints via typeinfo.
17:39:23NimBotAraq/Nimrod devel 651f512 Andreas Rumpf [+0 ±1 -0]: Merge pull request #1408 from Skrylar/skry-unsigned-any... 2 more lines
17:39:58Demosit could use some nimrodic sugra
17:40:24AraqDemos: no, it's *very* simple
17:40:40Araqbut you're right that nobody knows it
17:40:45AraqI should blog about it, I guess
17:40:45Demosresult = device.lpvtbl.CreateRenderTargetView(device, cast[ptr ID3D11Resource](pBackBuffer), addr rtvdesc, addr rtv) is not exactly ideal
17:40:55Demosyes!
17:41:02Demosand recomend some books
17:41:19Araqbooks are often written by people who have time to write books
17:41:29Araqthat's a major problem ;-)
17:42:06Demosyes which is why you should recomend them.... API design is also somewhat of an abstract topic and I wager a lot of the books are full of hot air
17:43:20Demosthe whole OOP "coupling and cohesion" thing where they never talk about how those two things are often mutually exclusive
17:43:37Demoswell OOP APIs in general tick me off
17:44:49Araqyour device stuff looks like it needs some overloaded '.'
17:45:43Araqmacros are an alternative but then you're stuck with %foo(bar, baz) or wrap that again so that it becomes foo(bar, baz)
17:46:05Araqwhich is really not feasible for hundreds of procs
17:46:19Araqwell perhaps it is via codegen
17:46:32Demosyeah, I make a point to keep the wrapper as close to the C version as I can, that sugar will be in another module
17:48:23Araqbtw IMHO this shows how foolish this whole COM thing really is
17:48:58Araqwhy the indirection of a vtable? DLLs already provide the perhaps required indirection
17:50:29Araqdo they really have multiple different implementations that they pick after DLL loading? and if so, why?
17:58:51*superfunc joined #nimrod
17:59:19Demoswell I think they use it for versioning, so I can use a ID3D11Something2 with the ID3D11Device
17:59:49Demosbut getting the newer versions of stuff often requires doing a QueryInterface on the old version, which is dumb
18:00:03DemosCOM as a whole is pretty dumb
18:00:28Demosand OpenGL has the same thing, the DLL only has the functions to get the function pointers...
18:00:47Demosbut yeah, COM is a total clusterfuck
18:01:11adoniscikwhadaya expect, coming from MS :)
18:01:35DemosI remember a post on like gamedev.net where someone was like "I am reading this book about how great COM and ATL is and I want to make my whole game like that!" the first reply was "put the book down, now slowly walk away and contimplate your life"
18:06:07*Trustable1 quit (Remote host closed the connection)
18:25:11*gsingh93 joined #nimrod
18:26:01NimBotAraq/Nimrod devel 06bbd6e def [+0 ±1 -0]: flush -> flushFile in doc
18:26:01NimBotAraq/Nimrod devel 13875e5 Simon Hafner [+0 ±1 -0]: Merge pull request #1425 from def-/flush-doc... 2 more lines
18:27:52Matthias247Demos: it might me. But otherwise it's one of the cores of a pretty much used OS and has been around for ages. So it can't be too bad ;)
18:28:11Demoshave you used it? it is pretty bad
18:28:32Matthias247I've used it for DirectX - a llong long time ago
18:28:52Demosthe very strong versioning it has means microsoft can really change their APIs at a fast pace, and this has paid off for Direct3D, but otherwise it is just bad
18:28:54Matthias247but at least I have better memories about that than about OpenGL :)
18:28:58Demosand direct3D is "COM lite"
18:30:14Demosmodern OpenGL is OK, actually with the explicit layout, binding points, and locations, as well with the seperate layout extension it is almost exactly the same model as Direct3D11
18:31:36Matthias247but I read Microsoft now also provides "hat pointers" for easy COM ;)
18:32:03Demosyeah they have a whole fucking extension to C++
18:33:10Demosthey also have like 4 smart pointer classes that all work in different ways
18:33:47*Trustable joined #nimrod
18:33:53Matthias247hmm, c++ standard has also 4
18:34:02Matthias247and boost and QT provide even more ;)
18:34:32Demoswell all 4 of microsoft's are supposed to work like shared_ptr
18:35:08Matthias247I really would like ^ hat or sth. else for shared_ptr
18:35:13Matthias247hate the verboseness
18:35:24Demosbut some of them increment the ref count when you attach an object, some do not, some allow conversions with &, actually I think two of them allow & and use it differently
18:35:25Matthias247and rust even followed that :)
18:35:36Demosmeh
18:35:58Demosmore kinds of pointers (or any kind of type qualifier) is a bad thing
18:36:47Demosand the whole CoCreateInstance and GUID thing, DCOM and a TOTAL shitshow, the fact that COM always seems more verbose than the much simpler POSIX API
18:37:01Demosheck seems more verbose than the windows API sometimes
18:37:36*mwbrown joined #nimrod
18:37:55Matthias247but you can use from VB :-)
18:38:07mwbrownflaviu: I got Nimrod running on that small ARM chip yesterday
18:38:20mwbrownI was able to set up a two-second timer interrupt and hit breakpoints on it, so nothing interesting yet
18:41:39*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
18:42:40linkmonitorInteresting. Mind if I ask which flavor of ARM chip? We talking M0?
18:42:49mwbrownlinkmonitor: STM32F303
18:42:55mwbrown48k of RAM
18:43:05mwbrowntechnically 40K + 8K core-coupled
18:43:19mwbrownthe linker script separates them out, so I don't know if the 8K is directly accessible without some magic involved
18:43:45mwbrownlinkmonitor: it's also an M4 chip, which if I remember right is just the M3 plus some DSP instructions
18:45:10mwbrownThe only thing I'm worried about so far is what will happen if an interrupt is implemented in Nimrod. I don't want the GC doing anything during an interrupt, but I don't think there is any pragma that lets you temporarily suspend it
18:45:20*Johz joined #nimrod
18:45:38Matthias247cool
18:45:41mwbrownnot to mention it will have to execute in a different context than non-interrupt code, so there could be some weirdness there depending on when the switch occurs
18:45:46Matthias247you have it running with the GC?
18:46:07mwbrownMatthias247: unless there is something I have to do to explicitly disable it, I assume it's running
18:46:23linkmonitorisn't there GC_disable() in the system module?
18:46:34Matthias247mwbrown: if you can use ref pointers then it's probably running :)
18:46:51mwbrownMatthias247: haven't tried that yet. The only code I've run so far is the following:
18:46:55mwbrownhttps://github.com/mwbrown/nimrod_stm32f3
18:47:12mwbrownspecifically https://github.com/mwbrown/nimrod_stm32f3/blob/master/src/main.nim
18:49:43linkmonitorProbably too soon to ask, but any idea how much RAM you're using?
18:50:48linkmonitorOff to lunch, but I'll read the logs to catch back up.
18:51:05Matthias247according to that code it should use next to 0 ;)
18:52:04mwbrownlinkmonitor: It depends on how big the bss section ends up being. There's no heap so it is all statically-allocated
18:52:50Matthias247but there's a stack :)
18:53:57mwbrowntrue. No idea how much stack that Nimrod uses compared to bare C
18:55:35mwbrownThe stack is just whatever you have left over from the other memory, since it's at the very end. Linker script has this line:
18:55:36mwbrownPROVIDE(_stack = ORIGIN(ram) + LENGTH(ram));
18:55:47Matthias247but if there's no heap and no malloc then the question is which memory the GC uses ;)
18:55:56mwbrownalthough you could stick the stack in the CCM region and then be reasonably assured you have 8K of untouched ram, and leave 40k for everything else
19:00:39mwbrownonly thing I'm not looking forward to in this project is converting all those header files. libopencm3 has some magic somewhere IIRC
19:00:45*Jesin joined #nimrod
19:00:54mwbrownthey like to redefine symbols to make them CMSIS-compliant
19:01:13mwbrownbut in Nimrod I don't get access to that, so my interrupt handler has to be sys_tick_handler instead of the CMSIS symbol SysTick_Handler
19:02:30*Ven joined #nimrod
19:03:04*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
19:03:45Matthias247what does opencm3 provide over cmsis?
19:04:42mwbrownit's got helper functions and provides easy-to-use vector tables in your project. From what I understand you don't have to hunt down functions from each vendor, for instance, if you want to port your project from a STMicro chip to an Atmel chip
19:05:06mwbrownI could have used the STMicro stdperipheral library, but it's slightly less portable and more involved to set up
19:07:11Matthias247you can also use autosar and mcal ;)
19:07:25Matthias247ok, you probably better won't :)
19:07:49mwbrownha
19:08:01mwbrownlooked it up, saw the word "automotive" and noped right out of there
19:09:38Matthias247an extremly big extremly "standardized" RTOS for automotive microcontrollers. Including an hardware abstraction layer, PDU message router, etc.
19:10:58Matthias247as a bonus you need extremly expensive tools and lots of XML to build the software :)
19:11:16mwbrownnot to mention being trained in writing MISRA-compliant code I imagine
19:11:40*Jesin quit (Quit: Leaving)
19:12:34Matthias247yes, misra is also in there
19:22:08*io2 joined #nimrod
19:23:47*Jesin joined #nimrod
19:25:37*Jesin quit (Max SendQ exceeded)
19:26:23*Jesin joined #nimrod
19:40:10*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
19:40:20flaviutype pragma?
19:40:41flaviusorry, that was an old conversation
19:46:21VarriountMeep!
19:48:03*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:00:04adoniscikspeaking of type pragmas, does .byref. work with arbitrary types?
20:00:21adonisciksuch as type integer* {.byref.} = clong?
20:00:28adoniscikIt didn't for me
20:01:10Varriountadoniscik: 'type integer = ref clong'?
20:02:32adoniscikI suppose. What about arrays? When you have array[I, foo] and you want to use foo as a ref outside of the array, do you have to create a separate, alias type?
20:05:00Varriountvar x: ref foo = arr[i] should work, I think
20:07:04adoniscikactually ref did not work so well either. When you want to define a new variable type T : ref int, you can't say x : T = 1 because T is a ref, so you need to allocate a new T too, defeating my goal of trying to avoid so many addrs and ptrs. See what I mean?
20:11:59*ics joined #nimrod
20:14:14flaviuadoniscik: I think that'd be unsafe
20:14:39Araqvar x: ref foo = arr[i] does not work and shouldn't
20:14:45flaviutaking a refrence of an element in an array would lead to bad pointers should the array go away
20:15:12Araqadoniscik: you're doing it wrong. ;-)
20:15:26adoniscikI merely want args to be passed by reference; I don't want to define the variables themselves as refs
20:15:36adoniscikremember we talked about byref last night?
20:15:43adoniscikI could not get it to work
20:15:58Araqwell I already told you arrays don't require .byref and it works for objects
20:16:16Araqunless you have some crazy type aliasing perhaps
20:16:37adoniscikI have C types; cint, clong, etc.
20:16:45Araqand no, it doesn't work for 'int' but then 'var int' kind of does
20:17:17AraqC doesn't pass cint by ref anyway, but hmm you said it's Fortran, right?
20:17:41adoniscikcorrect, C wrapper to a Fortrant library
20:17:50adoniscikit's complicated, math stuff
20:18:06Araqyour best choice is 'var T' then
20:18:18Araqno ideal, but hopefully good enough
20:18:21adoniscikgood, that worked
20:18:41Araqmake a feature request please
20:18:43adoniscikat least I got rid of all the addrs on the "client" side
20:18:52Araqwe care about good old Fortran
20:19:01adoniscikbetter leave the ugliness to the library side
20:19:08adoniscikwhich nobody has to see
20:19:47Araqyeah, but importf is not science fiction
20:21:04Araqit's not hard to implement ... (famous last words)
20:21:18adoniscikif I have to pass an array to a Fortran library, do I have to manually transpose it from row-major to column-major form, is there some sugar/helper function/pragma I can apply?
20:22:23Araqthere is nothing like that
20:22:36Araqyou can however do something like:
20:22:50Demoshow much cruft is in typical fortran, I know ye olde fortran had nasty stuff like textual import and a preprocessor
20:23:18Araqtype FortranArray[T] {.unchecked.} = distinct array[1, T]
20:23:55Araqconverter toFortranArray[I, T](x: array[I, T]): FortranArray[T]
20:24:12Araqwith a bit of luck this works with today's compiler ...
20:24:50Araqproc foo(a: FortranArray[float]) {.importc: "foo", ... .}
20:24:53adoniscikyeah, coz I am using incantations like proc foo[A,B,C,D, ...] to feed each array its own range
20:25:15adoniscikit's an alphabet soup :)
20:25:55Araqhmm I can imagine
20:26:06Araqwell you can always do it more low level
20:26:22Araqlike array[N*M*P, float]
20:27:12Araqand then have some accessors
20:27:21Araqthis way you also don't need to transpose anything
20:31:36NimBotAraq/Nimrod devel 779f2b3 Dominik Picheta [+0 ±1 -0]: Fixes typeinfo after PR #1408 broke it.
20:31:57*Jessin joined #nimrod
20:33:01VarriountHey Araq, where in the documentation should the style guide be mentioned?
20:34:29adoniscikAraq, when you defined FortranArray, did you mean really array[1, T] (number) or array[I, T] (interval)?
20:34:53flaviuadoniscik: array[1, T]
20:34:57*Jesin quit (Ping timeout: 256 seconds)
20:35:02adoniscikokay
20:35:04flaviuThe {.unchecked.} pragma turns off bounds checking
20:35:31flaviuI personally prefer array[0..0, T], but it doesn't matter
20:36:40AraqVarriount: well we need some better documentation overview page
20:36:50Araqpeople already don't find anyting in this "overview"
20:37:06AraqI have no idea how to improve it though...
20:37:50flaviuSearch?
20:40:26adoniscikI get an implementation expected error
20:41:37flaviuadoniscik: Can you gist the relevant portions?
20:41:54adoniscikjust what we discussed: FArray[T]* {.unchecked.} = distinct array[0..0, T]
20:42:02adoniscikError: implementation of 'FArray' expected
20:42:10adoniscikthis is inside a "type" blcok
20:43:35flaviutype FArray* {.unchecked.} [T] = distinct array[0..0, T]
20:44:07adoniscikoh
20:44:07flaviuits hard to remember the order, just rearrange the *, {. ... .}, and [Ts]
20:44:42adoniscikbasically I got it totally wrong :)
20:47:22VarriountAraq: I could ask one of the website reddits to give suggestions...
20:49:23*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
20:51:27adoniscikThe converter Araq wrote does not work with array expressions, whose type is array _constructor_. I could nto find a way to declare array constructors as converter args
20:52:03AraqVarriount: hmm getting useful feedback from the Internet ... that's a new concept for me
20:52:40Araqadoniscik: yeah well ... sorry
20:53:17adoniscikI've run into problems with the difference between arrays and array constructors before, so this is a good opportunity for me to learn I guess :)
20:58:35Araqwell no
20:58:40Araqthese are just bugs...
20:58:41mwbrownMatthias247: just confirmed that the ARM chip is NOT in fact using the GC and cannot until some other code is present
20:59:08mwbrownMatthias247: tried adding a ref type and called new() on it, got the following error: "system module needs 'nimGCunrefNoCycle'"
21:00:14adoniscikAraq, are you responding to me? So I should not be getting errors like Error: type mismatch: got (Array constructor[0..15, cdouble]) but expected 'FArray[cdouble]'?
21:01:03Araqadoniscik: correct
21:06:53*Jesin joined #nimrod
21:08:33*Jessin quit (Ping timeout: 240 seconds)
21:13:57*Jesin quit (Ping timeout: 245 seconds)
21:16:43*io2 joined #nimrod
21:18:19*Trustable1 joined #nimrod
21:18:27*Trustable1 quit (Remote host closed the connection)
21:20:04flaviuI'd guess and say that Array constructor[I, T] needs to be a subtype of Array[I, T]?
21:21:21Araqsubtype, supertype, all banana
21:21:39Araqarray constructor needs to be removed from the language
21:21:54Araqwhat it accomplishes can be easily done with other mechanisms
21:22:07*Matthias247 quit (Read error: Connection reset by peer)
21:22:23Araqas far as I remember it's not part of the spec either
21:22:45*Ven joined #nimrod
21:43:09*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:47:06*Jesin joined #nimrod
21:47:36adoniscikdo you have any suggestions in the meantime?
21:48:29Araqdo you have a simple test case that triggers it?
21:51:53adoniscikany array? Try let x: FArray[int] = [1,2,3]
21:52:20adoniscikAs simple as it gets
21:52:24Araqmake a gist please
21:53:38adoniscikhttp://pastebin.com/E2GDjGce
21:54:32Demoshow do people like to deal wtih exceptions, just stick them in the file where they are thrown? common file? a mix?
21:54:48Demosthe declerations that is
21:55:07Araqadoniscik: well 'distinct' obviously is not compatible with its underlying base type
21:55:15Araqthat's the purpose of the 'distinct'
21:56:07*Jessin joined #nimrod
21:58:01*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
21:59:22*Jesin quit (Ping timeout: 260 seconds)
22:00:20*Johz quit (Remote host closed the connection)
22:01:21*Jessin quit (Quit: Leaving)
22:02:36adoniscikremoving the distinct didn't make a difference though. What am I missing?
22:03:25Araqwell the 'unchecked' doesn't mean type checking is disabled
22:03:48Araqso an array of length 5 is not compatible to an array of length 1
22:05:56adoniscikso what does this "unchecking" achieve if the base types match?
22:07:47adoniscikI feel as though we are where we started
22:07:57Araqthat you can at runtime do a[4] when there is officially no such index
22:08:52*Trustable quit (Quit: Leaving)
22:12:22flaviuadoniscik: Maybe a converter from array[I, T] to FArray[T]?
22:12:40flaviuthat uses cast, although cast does do memcpy iirc
22:12:53adoniscikI fail to see how that helps. Recall that we were trying to avoid the generic alphabet soup of proc foo[A,B,C,D,...] that arise from the need to declare array intervals
22:13:10adoniscikflaviu, right, but you get the same array constructor error
22:13:21adoniscikor maybe I do since I made a mistake; please try it yourself
22:13:34adoniscikI tried both converter toFArray[I, T] (x: array[I, T]): FArray[T] = FArray(x) and converter toFArray[I, T] (x: array[I, T]): FArray[T] = cast[FArray](x)
22:14:53adoniscikis this converter supposed to be invoked automatically, because it is not (for the same reason: it sees an array _constructor_, not an array)?
22:18:19flaviuWell, I got it to compile, but it segfaults
22:20:26flaviuOh, I see. Recursive call in the converter
22:22:56flaviuadoniscik: Ok, got it: https://gist.github.com/7aab80daa9e13fcac456
22:24:11flaviuI stick it in a local var so I can get a pointer to it, and then I take the address, which discards all the type information. That can then be casted
22:24:49adoniscikI would not have thought of that.
22:24:57adoniscikand indeed I did not :)
22:25:29flaviuIt does involve a memcpy though
22:26:24adoniscikokay so if we're in the business of copying, this looks like just the right place to do the row-major order to column-major order conversion
22:28:27adoniscikactually it did not work for me, so something must have got fixed since 0.94
22:28:33OrionPKhello all
22:29:42*superfunc quit (Ping timeout: 260 seconds)
22:29:45flaviuActually, that code may be broken. It seems I'm hitting undefined behavior
22:30:09adoniscikbut you don't get the type mismatch error I do
22:33:15flaviuadoniscik: What error do you get
22:33:26adoniscikError: type mismatch: got (Array constructor[0..4, int]) but expected 'FArray[int]'
22:44:15VarriountAraq: What part of the compiler needs to be touched to fix the bug involving casting to an openarray? semcast?
22:44:33Araqyup
22:44:52Araqyou touched that once, right?
22:45:16VarriountYeah.
22:45:47VarriountAraq: Your sure it's not another part of the compiler you want modified? Like some type-checking part or something?
22:45:55Araqwhat about that trailing slash bug?
22:46:04AraqVarriount: yeah, pretty much
22:46:05VarriountWorking on it.
22:46:09Araqok
22:46:19Araqwhy does it take so long?
22:46:26Araqit's a pretty simple fix?
22:46:40VarriountAraq: Because I keep getting interuppted at my computer.
22:47:01Araqthe trick is to pull out the internet
22:47:02*mwbrown quit (Ping timeout: 240 seconds)
22:47:19Araqit's a gigantic waste of time
22:47:27VarriountI keep getting interuppted by my family.
22:47:36VarriountNot the internet, oddly enough.
22:48:02Araqhum interesting
22:48:17flaviuAraq: Do you have any more ideas on how to cast the array?
22:49:30Araqflaviu: cast it to ptr FArray
22:50:26Araqor use .emit in the converter's body ffs
22:51:26Araqbut seriously
22:51:45Araqhow hard is it to understand that arrays are a value type just like tuple?
22:54:58Araqarray[left..right, PTree] # 2 PTree pointers, indexable so that all the tree symmetries can be exploited for small code size
22:55:10Araqnow try that with Java
22:56:03flaviu`Tree[]`?
22:56:53flaviuTree<T>[] actually, since this is generic.
22:57:33Araqyeah but this misses the point
22:57:56Araqyou get an additional unnecessary indirection in Java
22:58:16Araqplus you can only index the array with integers
22:58:32flaviuAraq: There's a guy on Oracle working point #1
22:59:16Araqafter they denied there is a problem for decades
22:59:56AraqJava programmers are too stupid to use all these "new" features anyway
23:00:01flaviuwow, nearly two decades
23:00:09flaviuYou're right, that is impressive
23:00:33flaviuAnyway, thats the main reason I moved away from java, along with type erasure
23:00:46*darkf joined #nimrod
23:04:28flaviuadoniscik: Ok, got it to work without any gimmicks and without undefined behaivior
23:04:35flaviuhttps://gist.github.com/27d152172a4c26b804c3
23:04:50adoniscikaha, thanks, let me check
23:05:30*superfunc joined #nimrod
23:06:21Araqseriously? boxing? :P
23:07:58flaviuIsn't the caller of a converter responsible for setting up the memory for the output?
23:08:53Araqno, that's the compiler's job
23:09:03flaviuThere isn't any way for the caller to know the size of the output here, but it allocates space for 1 T, which causes problems because the input array is more than one T
23:09:29flaviuAraq: Well, the compiler sets up the memory for the caller without the programmer worrying about it
23:12:19Araqoh come on now
23:12:32Araqyou use .unchecked and then don't know what it does
23:13:15Araqsome features are designed for the people who know what they are doing
23:13:35flaviuDoesn't unchecked just turn off bounds checking?
23:13:44VarriountAraq: Should I avoid string copies at all costs?
23:14:52Araqflaviu: well as you noted the compiler still thinks the size is "correct" and allocates that amount for you
23:15:13VarriountOr more directly: Can I just use removeTrailingDirSep to create a copy of a path marked for exclusion that lacks trailing directory seperators?
23:15:53Araqyou can do that but then some fool uses cmpPath in a newly created benchmark and people will say "oh nim sux"
23:16:09Araqit's your choice
23:16:12VarriountAraq: This isn't in cmpPath, this is in the compiler code.
23:16:30Araqwell but it should be in cmpPath
23:17:04Araqin the compiler it's fine, this is never in the critical path
23:17:20VarriountBut aren't /foo and /foo/ technically referring to different things?
23:17:57AraqI can't see how
23:18:20Araqno software that I use distringuishes between these two
23:21:37Araqflaviu: don't miss your chance to correct me
23:26:46Araqspeaking of which ... what does ssh:/hg@hg//hg/foo/bar mean?
23:27:12VarriountAraq: What should cmpPath("%HOME%/AppData", "C:/Users/Clay/AppData") return when %HOME% is "C:/Users/Clay"?
23:27:27Araqwhy the double slashes?
23:27:52AraqVarriount: something. don't expand environment variables in cmpPath
23:28:23Araqand as usual the effect system helps here
23:28:43Araqexpanding env vars produces the FReadEnv effect
23:28:54Araqso ... this is a breaking change :P
23:31:03AraqVarriount: keep in mind that cmpPath is for sorting. it doesn't compare whether the files are the same, it doesn't follow symlinks, it doesn't expand env vars, it doesn't translate into DOS's 8.3 format ...
23:31:23*othello quit (Quit: Page closed)
23:31:53*mwbrown joined #nimrod
23:33:14*linkmonitor quit (Quit: Page closed)
23:37:12flaviuAraq: I was too busy getting chocolate chip cookies to eat
23:38:17Araqwell you can still tell me how dumb I am
23:38:25flaviuFirefox uses those rules
23:39:09flaviuOh, sorry, wrong rules
23:39:29flaviuWell, the http server for the llvm blog uses the rules you were referring to
23:39:38*gsingh93 quit (Quit: Connection closed for inactivity)
23:40:26*xenagi joined #nimrod
23:42:21flaviuex, look at http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html and at http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html/
23:46:09flaviuIt seems that if you add a slash where there wasn't one, you get an error. However, if you remove the trailing slash, you get redirected. Although I don't know if this is because firefox is messing around with the URL
23:47:42Araqpaths are not urls ...
23:48:22flaviuThey are URIs, and therefore behave by the same rules
23:48:39AraqURIs came much later
23:49:08Araqyou can't pretend every path is an URL when it's clearly not
23:49:21flaviuThey are referring to different things: /foo is a file. /foo/ is a dir
23:49:30flaviu /foo != /foo/
23:49:37Araqcd /foo
23:49:44Araqoops, this works
23:49:56Araqstupid cd
23:49:58flaviuAraq: 1 sec, I can't figure out the notation I want to use
23:50:04flaviuThat was incomplete
23:50:28flaviu /foo => /foo/
23:50:28flaviu /foo/ !=> /foo
23:51:05flaviu /foo can mean /foo/; /foo/ can never mean /foo
23:52:20flaviuTherefore, the only correct solution is to check that /foo is a dir, and then your reasoning holds
23:53:04flaviuBut that takes time, and the only way to be sure that foo is a dir without checking is to stick to the convention `/foo/`
23:53:20Araqthat's a sideeffect
23:53:31AraqcmpPath has no effects
23:56:44flaviuSo you're required to follow the URI rules then
23:57:13Araq /foo vs /foo/ should not depend on the HD's contents, that is insane
23:57:59flaviuIf you can't assume that the trailing slashes are correct, that is the only way to achieve reasonable results
23:58:05Araqmaybe you should read cmpPath's docs
23:58:19Araqit does a case insensitive comparison on windows
23:58:50Araqdo you think this "follows URI rules"?
23:59:21Araqand again, why should it, URI rules are bullshit
23:59:35*saml_ joined #nimrod