<< 09-05-2019 >>

00:11:02*theelous3_ quit (Ping timeout: 246 seconds)
00:14:28clyybbergood night
00:14:29*clyybber quit (Quit: WeeChat 2.4)
00:31:24*rnrwashere joined #nim
00:34:46cy1How do you strify something in a template? like let name: string = #name
00:37:30FromGitter<jrfondren> you can do that easily with a macro, and you can have the macro use a template for simplicity
00:37:55FromGitter<jrfondren> https://gist.github.com/jrfondren/829889fe6519118a71fb1ce76386e972 <- example of that
00:38:54cy1yeah I know. Just hoped you could do it with only a template.
00:44:01rayman22201you can pass a string to a template for a simple case: http://ix.io/1Is2/nim
00:59:44*ryanhowe joined #nim
01:00:39*ryanhowe quit (Client Quit)
01:26:38*shodan45 quit (Quit: No Ping reply in 180 seconds.)
01:30:58*shodan45 joined #nim
01:32:59*laaron- joined #nim
02:00:17*banc quit (Quit: Bye)
02:02:35*dddddd quit (Remote host closed the connection)
02:08:28*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
02:10:16*PrimHelios joined #nim
02:11:43*laaron- quit (Quit: ZNC 1.7.1 - https://znc.in)
02:12:13*laaron joined #nim
02:16:38*PrimHelios quit (Quit: Leaving)
02:22:14*banc joined #nim
02:43:39*rnrwashere quit (Ping timeout: 248 seconds)
02:51:05*sacredfrog joined #nim
02:56:35*disruptek quit (Ping timeout: 246 seconds)
02:59:52*PrimHelios joined #nim
03:00:30PrimHeliosI found a bug present in master that's fixed in devel. Should I send a PR to merge the bugfix, or just wait until the commit trickles into master?
03:02:31*disruptek joined #nim
03:02:54*sacredfrog quit (Quit: WeeChat 1.9.1)
03:04:05shashlick@narimiran usually backports devel fixes that are relevant into the version-0-19 branch which will become 0.19.6 in the near future
03:10:36*PrimHelios quit (Quit: Leaving)
03:11:01*PrimHelios joined #nim
03:14:55*SenasOzys quit (Ping timeout: 258 seconds)
03:29:59FromGitter<jrfondren> cd moe
03:31:41*PrimHelios quit (Quit: Leaving)
03:31:52*PrimHelios_ joined #nim
04:24:08*nsf joined #nim
04:42:52*narimiran joined #nim
04:56:04*cyberjpn joined #nim
04:57:49shashlickjust added dynlib support to nimterop
05:22:48cy1Man, how do you export a template, and also all the stuff it needs imported?
05:23:13FromGitter<jrfondren> you add a * to all that stuff yourself, I believe
05:24:11cy1No, I mean you can't do "from X import Y" in the template, if it's ever used outside of top level. So anyone using your template is going to get an error like "Error: invalid pragma: async" when they never even used the async pragma.
05:24:25cy1Or whatever stuff you needed imported.
05:24:37FromGitter<jrfondren> right. in that case the user has to also import async.
05:24:52FromGitter<jrfondren> there's no smart import or smart export
05:25:06cy1Yeah, and just keep running the program repeatedly manually adding imports for each error.
05:25:55cy1The language really could use smart import or export, or at least some way to bind imports to the template.
05:26:31FromGitter<jrfondren> you can even define a template that refers to identifiers that don't exist until after the module with the template is imported
05:27:05cy1Or imports outside of top level. Those would be real nice too. Just import what you need inside the template code.
05:30:58*SHILL is now known as uptime
05:36:30*hoijui joined #nim
05:41:04cy1When you create a generic procedure, that creates one procedure for each type, right? Like a template would?
05:43:51leorizecy1: there's a kind of symbol borrowing in the compiler iirc
05:44:14leorizesince you don't have to export symbols for generic proc
05:44:24leorizeyou can always bind them explicitly via `bind`
05:46:57cy1Oh, is that what bind is for...?
05:46:59shashlick@leorize: looking forward to your feedback on recent nimterop improvements
05:47:15leorizeI'm taking a small break atm, so you'd have to wait
05:47:44leorizecy1: to force a symbol to be bound as early as possible
05:48:14leorizeusually the compiler will bind symbols in template automatically (symbols taken at declaration site)
05:48:30leorizebut sometimes it just doesn't do so, `bind` is to force that
05:48:45shashlickno rush, thanks in advance
05:49:58cy1I'll mess with it, thanks leorize
06:17:14*traviss joined #nim
06:20:51travisscan anyone spot whats i'm doing wrong in this anonymous function from 'import sugar'?
06:20:56travissecho @[(1, 2)].mapIt(((a, b)) => a+b)
06:21:14cy1or I could refactor all the complicated logic into procedures like a smart person, and have simple templates that don't use imported symbols
06:21:16travissError: Incorrect procedure parameter list.
06:22:32cy1traviss: doesn't mapIt have its own special mini-language, where you treat literally "it" as the item in the list?
06:22:55cy1so like... @[(1,2)].mapIt(it[0] + it[1])
06:23:25travissoops, thanks. i forgot to switch back do map from mapit
06:24:12cy1np
06:24:41travissso there's no way to destructure the tuple like i was attempting?
06:25:16travissi thought this would work but its not: echo @[(1, 2)].map(((a, b)) => a+b)
06:27:22*jasper_ joined #nim
06:27:31cy1um... not sure. I don't know if Nim has a syntax for lambda sorts of things.
06:28:16cy1proc (a,b: int) = and then newline is required
06:30:05leorizecy1: see sugar module
06:30:34leorizewho needs special syntax when you have macros :P
06:31:42travissi'm just messing around learning how to use sugar and destructuring
06:32:12cy1ooh okay I've never used that
06:32:52travisslooks like the mapIt(it[0] + it[1]) is the easiest for this use case
06:36:43*zestyr quit (Ping timeout: 245 seconds)
06:38:03*PMunch joined #nim
06:40:14*zestyr joined #nim
06:40:59narimiran!eval import sugar; echo @[(1, 2)].map((a, b) => a+b)
06:41:01NimBotCompile failed: in.nim(1, 29) Error: attempting to call undeclared routine: 'map'
06:41:12narimiran!eval import sugar, sequtils; echo @[(1, 2)].map((a, b) => a+b)
06:41:13NimBotCompile failed: in.nim(1, 39) Error: type mismatch: got <seq[tuple of (int, int)], proc (a: GenericParam, b: GenericParam): untyped>
06:56:52travissoh cool i didn't know nimbot could do that. this is what I was thinking might work, adding extra parens to indicate and destructure tuple
06:57:02traviss!eval import sugar; echo @[(1, 2)].map(((a, b)) => a+b)
06:57:03NimBotCompile failed: in.nim(1, 29) Error: attempting to call undeclared routine: 'map'
06:57:31traviss!eval import sugar, sequtils; echo @[(1, 2)].map(((a, b)) => a+b)
06:57:32NimBotCompile failed: ../nim/lib/pure/sugar.nim(87, 14) Error: Incorrect procedure parameter list.
07:00:00*gmpreussner quit (Quit: kthxbye)
07:00:05Araq!eval import sugar, sequtils; echo @[(1, 2)].map((a, b)) => a+b)
07:00:06NimBotCompile failed: in.nim(1, 58) Error: invalid indentation
07:00:13Araq!eval import sugar, sequtils; echo @[(1, 2)].map((a, b) => a+b)
07:00:15NimBotCompile failed: in.nim(1, 39) Error: type mismatch: got <seq[tuple of (int, int)], proc (a: GenericParam, b: GenericParam): untyped>
07:00:59Araqah you need tuple destructuring inside parameters
07:01:00narimirantraviss: hmm, i get errors even locally. i guess `mapIt` is after all your best option
07:01:29Araq!eval import sugar, sequtils; echo @[(1, 2)].map(a => a[0]+a[1])
07:01:31NimBot@[3]
07:01:57Araqwe could make => support destructuring...
07:02:07travissyeah, i think parameter destructuring would be a great feature
07:02:24narimiran+1
07:02:26travissfor the whole language
07:02:43Araqnah, it's a niche case but it would be fine for `=>`
07:04:46*gmpreussner joined #nim
07:05:01narimiranPMunch: is there any chance that Ctrl+/ could toggle comments on nim playground?
07:06:40PMunchToggle comments?
07:06:48PMunchAs in removing comments in the code?
07:10:07narimiranPMunch: `let a = 1`, ctrl+/, `# let a = 1`, ctrl+/, `let a = 1`
07:10:38PMunchAah, for the editor
07:14:50*krux02 joined #nim
07:15:47PMunchShould be as easy as enabling Sublime keymap mode: https://codemirror.net/demo/sublime.html
07:23:56*hoijui quit (Ping timeout: 252 seconds)
07:33:17*solitudesf joined #nim
07:39:15*hoijui joined #nim
07:43:57*laaron quit (Remote host closed the connection)
07:47:27*laaron joined #nim
07:54:57shashlick@arnetheduck: just ran http://ix.io/1Itr/nim - llvm wrapper made with nimterop and got http://ix.io/1Itq/nim
07:55:29shashlickit compiles
08:04:35*cyberjpn quit (Ping timeout: 246 seconds)
08:13:07FromGitter<mratsim> wow awesome, I would need that in the future
08:13:36FromGitter<mratsim> Does LLVM C++ API compile as well?
08:15:14*Vladar joined #nim
08:28:30*krux02 quit (Remote host closed the connection)
08:37:34*NimBot joined #nim
08:46:05WilhelmVonWeinerso `rand` is considered to have side effects
08:46:15WilhelmVonWeinerwhich is quite annoying
08:47:11*dddddd joined #nim
08:50:28narimiranWilhelmVonWeiner: if that's in the context of "i can't have `func` if it has `rand` in it" - it is because `func` must always return the same output for the same input. that's not the case if it depends on `rand`
08:51:05WilhelmVonWeinerI get why, it's just kinda lame if reasonable
08:51:08*WilhelmVonWeiner shrugs
08:52:23PMunchIt's not lame, it's correct..
08:52:56FromGitter<mratsim> It doesn't have sde effect if you use initRand() and always pass the RNGState you just created
08:53:19PMunchYeah, was just about to say
08:53:28WilhelmVonWeinercorrect can totally be lame
08:53:30PMunchAs long as the RNG state is passed in then it doesn't have side-effects
08:54:35FromGitter<mratsim> We call that law, lawyer and legal around here ;)
08:56:10PMunchhttps://play.nim-lang.org/index.html?ix=1ItC
08:58:53FromGitter<alehander42> I don't use func much
08:59:26FromGitter<alehander42> Is it possible for nim to somehow show me which procedures are pure anyway
08:59:34FromGitter<alehander42> Without trying to func them
09:00:02FromGitter<alehander42> So I can change them to func, something like atomic
09:00:11FromGitter<alehander42> Atomic
09:00:16FromGitter<alehander42> Autofix
09:00:45FromGitter<alehander42> Sorry
09:02:44*laaron quit (Remote host closed the connection)
09:05:02WilhelmVonWeinerwell it does detect when {.noSideEffects.} is misapplied so it *could*
09:05:11*laaron joined #nim
09:13:41*stefanos82 joined #nim
09:13:52*jasper_ quit (Quit: Page closed)
09:17:11*cyberjpn joined #nim
09:19:44*clyybber joined #nim
09:23:59*theelous3_ joined #nim
09:33:13FromGitter<mratsim> @alehander42 I think the doc generator automatically tags it, along with "raises"
09:33:18FromGitter<mratsim> but I might be wrong
09:50:17*theelous3_ quit (Ping timeout: 246 seconds)
09:51:30Mister_Magisteram i weird or telebot doesn't compile
09:55:52*cyberjpn quit (Ping timeout: 245 seconds)
10:12:26*JStoker quit (Ping timeout: 258 seconds)
10:12:29Araqhttps://docs.python.org/3/library/asyncio-task.html#generator-based-coroutines
10:12:51Araqoh look, Python got async slightly wrong and they deprecate something.
10:14:46*JStoker joined #nim
10:16:29*cyberjpn joined #nim
10:20:26*kapil____ joined #nim
10:32:53clyybberAraq: Now this is weird, I thought I just recently read how you really should use generators for async in python
10:39:44FromGitter<mratsim> I think it's more that they now have 2 ways of async and don't want to support 2 ways
10:40:41FromGitter<mratsim> since closure iterators in Nim can accept arguments while in the loop we could also implement an async lib on top.
10:42:24Araqhuh? .async uses closure iterators
10:43:57FromGitter<alehander42> Arab do you see an actor library working with no gc
10:44:10FromGitter<alehander42> Just randomly asking not really on topic
10:44:11Mister_Magistercan i update package with nimble?
10:44:17Mister_Magisteror do i have to remove and reinstall it
10:44:20FromGitter<alehander42> But happened to.think about that these days
10:45:29FromGitter<alehander42> I feel like often actors can use a small constant part of memory which is then reused by new actors but maybe this isn't easy to automate
10:46:14Araqalehander42: I don't see any problems with it
10:46:47Araqyou can have a container of all actors that "owns" the actors and when an actor dies, it unregisters from the container
10:47:20Araqmaybe it doesn't win prizes in elegance but I don't see any major problems
10:47:49clyybberelegance is hiding everything in macros
10:49:56narimiran@mratsim: "Also while i < stop - IntSize: is cleaner" heh, i believed you there for a second ;) it is cleaner but it is "wronger" :D
10:50:10solitudesfMister_Magister, just install it again, new version will get installed alongside
10:50:59Mister_Magistersolitudesf: alongside but older will remain, useless garbage that only hold space right?
10:51:18solitudesfif you dont need it you can delete specific version
10:51:37Mister_Magisterso uninstall and reinstall okay
10:54:21FromGitter<mratsim> @alehander42 this is basically an object pool
10:54:47FromGitter<mratsim> I think object pools should be in the standard lib btw
10:56:06FromGitter<mratsim> but when you use object pools you can't use {.noSideEffect.} anymore (or maybe Allocator would be an exception to that?)
10:57:08*cyberjpn quit (Ping timeout: 246 seconds)
11:00:45clyybberwhat syntax would you prefer for per-parameter bycopy/byref :
11:00:46*seni joined #nim
11:00:51clyybberproc monitorCecTraffic(a1: pointer, msg: cec_log_message {.bycopy.}): cint
11:00:54clyybberor:
11:01:08clyybberproc monitorCecTraffic(a1: pointer, msg {.bycopy.}: cec_log_message): cint =
11:01:29clyybberAraq: I guess the latter would be more consistent with the pragma after identifier rule?
11:01:47Araqmratsim: you can do {.noSideEffect.}: <stuff here> in devel
11:02:26FromGitter<mratsim> enven if it accesses a global var (the object pool?)
11:02:39Araqyeah, it's like a .gcsafe block
11:02:55Araqor like C++'s 'mutable' keyword
11:03:36FromGitter<mratsim> the {.myPragma.}: syntax always feel super weird but good
11:07:33*rnrwashere joined #nim
11:12:27Araqit's ugly by design
11:12:37Araqlike 'cast', since it's an ugly thing to do
11:12:40Mister_Magistersolitudesf: oh u answered in my issue. interesting
11:12:59FromGitter<mratsim> btw I'm re-reading the typedesc vs generics argument and stumbled upon that: https://github.com/nim-lang/RFCs/issues/40#issuecomment-381222385 ⏎ ⏎ > Bugs should not be taken as an argument unless the number of bugs justifies an argument like "these bugs indicate an overly complex design". ⏎ ⏎ While I don't think typedesc vs generics are at that breaking point, I think generics symbol early resolution is:
11:12:59FromGitter... https://github.com/nim-lang/Nim/issues/8677. ... [https://gitter.im/nim-lang/Nim?at=5cd40b3bf251e60ffa4fdb74]
11:13:04FromGitter<mratsim> seems fair
11:14:04FromGitter<mratsim> I didn't try yet but I'm sure cooldome will have issue in his "reset" destructors PR: https://github.com/nim-lang/Nim/pull/11206#discussion_r282379786
11:15:24Araqmratsim: I've read it and don't understand your point
11:15:29FromGitter<mratsim> Imo it can wait after 1.0, but it seems to be a daunting task to refactor the generics/static/typedesc semchecks
11:16:03Araqthe problem with generics is that we don't type-check them. concepts would be our way out if they would be ... type-checked.
11:16:40Araqall the guesswork with symbol bindings etc comes from the fact that we don't typecheck generic procs.
11:16:54FromGitter<mratsim> The point is that all kind of things that work in normal procs, don't in generics (see {.this:.} the issues we had in strformat and several other linked issues
11:17:24*Araq shrugs
11:17:47Araqstrformat is a heavy macro, macro systems always have composability problems
11:18:16FromGitter<mratsim> Async also has issues.
11:18:43FromGitter<mratsim> We shouldn't say "macro"/generics are second-class citizens
11:19:31Araqthey are not, but they are intrinsically more complex than non-generic code
11:19:57Araqthat's just the reality in every language that does offer generics
11:20:46FromGitter<mratsim> I agree. What I'm saying is that in the future, we will have more people stumbling on those.
11:22:14FromGitter<mratsim> Assuming we want macro to be a blessed way to expand the language (like async) instead of implementing things in the compiler, I think it's a important problem to solve.
11:22:33Araqwell be my guest and come up with "better" rules for what defaults to a mixin/bind binding
11:23:03Araqkrux02 is also thinking about this problem :P
11:23:11FromGitter<mratsim> Do you have a functional description of the rules? Can you addd them in the meta issue?
11:23:24Araqit's written down in the manual
11:23:30FromGitter<mratsim> I have nightmares about this problem :p
11:24:01AraqI was happy when my set rules seemed to worked better than C++'s while at the same time being less complex
11:24:12*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
11:24:25Araq:P
11:24:35FromGitter<mratsim> well give a hand and people ask for an arm
11:25:59Araqwhat we need to do: attach procs to types. typecheck generics. leave room for 'untyped' code so that I can use $ on my generic T that wasn't specified to offer $ so that I can debug generic code
11:26:18*kapil____ is now known as kapil_
11:26:26*laaron joined #nim
11:26:31Araqthat's not a design we can do for v1
11:26:58Araqbbl
11:27:32Araqoh and let me be clear that "attach procs to types" requires no syntax change, relax, we don't need a 'class' keyword.
11:28:55FromGitter<mratsim> I agree that it should be for after v1
11:30:52*vlad1777d_ quit (Ping timeout: 245 seconds)
11:32:57Mister_Magisterwhen i'm trying to run "choosenim devel" i'm getting "Unable to extract. Error was 'Permission denied"
11:34:50*kapil_ is now known as kapilp
11:36:27FromGitter<mratsim> did you run choosenim as root initially?
11:59:43*Snircle joined #nim
12:13:51*sacredfrog joined #nim
12:14:26*sacredfrog quit (Client Quit)
12:17:07*cyberjpn joined #nim
12:24:45*sacredfrog joined #nim
12:31:42*abm joined #nim
12:33:53*sacredfrog quit (Quit: WeeChat 1.9.1)
12:42:48*sacredfrog joined #nim
12:43:49*sacredfrog quit (Client Quit)
12:45:59*sacredfrog joined #nim
12:49:11*rnrwashere quit (Remote host closed the connection)
12:49:45*laaron- joined #nim
12:49:47*laaron quit (Remote host closed the connection)
12:53:09shashlick@mratsim - about llvm wrapper, that's just the C wrapper, nimterop still doesn't know c++
12:54:53FromGitter<mratsim> ok, very nice nonetheless
12:54:56shashlickBut I really don't know since I just referred to the build script @arnetheduck has in his nlvm repo
12:59:18Araqshashlick: has the nimble regression been fixed that andreaferretti reported?
13:02:18zestyrAraq: did you have a look at the boehm issues on your Linux vm?
13:03:03shashlickYes Araq, the issue with recursive calls is fixed
13:17:41clyybberAraq: I'm working on allowing per-parameter bycopy and byref pragmas. I cant add the tfByCopy/tfByRef flags to the type of the parameter though, or it will affect the type everywhere. Should I introduce new sym flags or can I somehow copy the type and add the tfByCopy/tfRef flags to the copy?
13:18:49*ng0 joined #nim
13:19:13Araqclyybber: the last thing we need is more tyAlias bullshit types with different flags so that you don't affect the existing types, as you noticed
13:19:42Araqhowever, per-parameter bycopy and byref pragmas cannot work for proc pointers
13:22:52clyybberOk, I will try the sym flag method
13:23:01clyybberWhy can it not work for proc pointers?
13:23:38Araqtype Foo = proc (x: T) # compatible with proc f(x {.bycopy.}: T) ?
13:23:55Araqthis feature is not thought-through, sorry.
13:24:00clyybberyeah, fair enough
13:27:28Mister_Magisterare there symbols for and, is etc operators? and how to compare strings?
13:28:44narimiranMister_Magister: "a" < "b"
13:29:34Mister_Magisternarimiran: but how do i check if they are equal?
13:29:47narimiranMister_Magister: "a" == "b"
13:31:17Mister_Magisternarimiran: and is there character for and? like &&?
13:31:25narimirannope, you use `and`
13:31:34Mister_Magisterthanks!
13:31:44Mister_Magistercan i cast type to string?
13:33:01FromGitter<jrfondren> just use `$`
13:33:08Mister_Magister$?
13:33:22FromGitter<jrfondren> the operator. `echo $int` f.e.
13:33:47FromGitter<jrfondren> if you want to get the type of something to then get the string of that type, the typetraits module has type()
13:34:05FromGitter<jrfondren> so `echo $type(42)`
13:34:23narimiranMister_Magister: we could be more helpful if you tell us more precisely what are you trying to achieve
13:34:25FromGitter<jrfondren> (typetraits it also where I got the `int` from)
13:35:11Mister_Magisternarimiran: just learning stuff i have unknown object with unknown type that i know is text and i want to check if there is "whatever" in it
13:35:29FromGitter<jrfondren> "unknown type that i know is text"?
13:35:51Mister_Magisterye ye it comes from telebot lib
13:36:07FromGitter<jrfondren> I have no idea what you mean.
13:36:13narimiranneither do i
13:36:43narimiranbtw, you can do `"whatever" in myText`
13:36:51Mister_Magistercan i?
13:36:54Mister_Magisterthanks
13:37:04Mister_Magisterrhanks also for type thingy, now i know it's string
13:37:19Mister_Magistersorry for being hard to understand
13:37:19narimiransee, that's why i told you to ask precisely. https://en.wikipedia.org/wiki/XY_problem
13:37:41Mister_Magisternarimiran: i tried but u didn't understand "/
13:37:44Mister_Magister:/
13:37:46FromGitter<jrfondren> !eval "whatever" in "this string contains whatever"
13:37:47NimBotCompile failed: in.nim(1, 12) Error: type mismatch: got <string, string>
13:38:02narimiran!eval echo "whatever" in "this string contains whatever"
13:38:03NimBotCompile failed: in.nim(1, 17) Error: type mismatch: got <string, string>
13:38:23FromGitter<jrfondren> ah it's in strutils
13:38:31Mister_Magisternarimiran: doesn't seem to be working :P
13:38:43solitudesfimport strutils
13:38:47narimiran!eval import strutils; echo "whatever" in "this string contains whatever"
13:38:49NimBottrue
13:39:01narimiranMister_Magister: :P
13:40:54Mister_Magisterthanks
13:43:59Mister_Magisterwhat is Option type?
13:45:00*nsf quit (Quit: WeeChat 2.4)
13:45:00narimiranhttps://nim-lang.github.io/Nim/options.html "types which encapsulate an optional value"
13:45:41Mister_Magisterohhh thanks
13:57:31*banc quit (Ping timeout: 246 seconds)
13:59:49*PMunch quit (Remote host closed the connection)
14:03:29*banc joined #nim
14:04:50Mister_Magisterhmm nim backtraces are so unreadable. i can't even read on which line there is problem
14:04:53FromGitter<mratsim> https://en.wikipedia.org/wiki/Option_type, also called Maybe in some languages
14:05:18FromGitter<liquid600pgm> they're as simple as it gets
14:05:26FromGitter<liquid600pgm> `file.nim(line) proc`
14:05:27FromGitter<mratsim> Really? what language are you coming from? I prefer nim stacktraces to Python or Java.
14:06:01Mister_Magisterwhen i'm trying to just "echo "whatever"" i'm getting Can't obtain a value from a `none`
14:06:48Mister_Magistermratsim: from c/c++/php
14:07:05FromGitter<mratsim> !eval import options; echo Option()
14:07:06NimBotCompile failed: in.nim(1, 28) Error: object constructor needs an object type
14:07:19FromGitter<mratsim> !eval import options; echo Optionint ()
14:07:20NimBotCompile failed: in.nim(1, 22) Error: undeclared identifier: 'Optionint'
14:07:27FromGitter<mratsim> !eval import options; echo Option\int\ ()
14:07:28NimBotCompile failed: in.nim(1, 32) Error: undeclared identifier: '\'
14:07:34Mister_Magister!eval echo "whatever"
14:07:36narimiranmratsim, your brackets are eaten on irc
14:07:36NimBotwhatever
14:07:38FromGitter<mratsim> well, can't use generics with GItter
14:07:38FromGitter<liquid600pgm> painful
14:07:42Mister_Magisterhm
14:08:13narimiranMister_Magister: " when i'm trying to just "echo "whatever"" i'm getting Can't obtain a value from a `none`" --> read the options module link i've sent you earlier
14:08:20Mister_Magisteri'm doning something wrong that i don't even know what yet
14:08:26Mister_Magisteroh okay
14:08:44Mister_Magisternarimiran: if i had an line for "Can't obtain a value from a `none`"" that would be easier
14:09:05narimiranMister_Magister: nah, you still wouldn't read provided links :P
14:09:10FromGitter<mratsim> from a none Option would be better
14:09:21*Mister_Magister blushes
14:10:48*cyberjpn quit (Ping timeout: 258 seconds)
14:11:32*Trustable joined #nim
14:12:11FromGitter<alehander42> hm
14:12:40Mister_Magisterokay fixed, thanks everybody
14:13:41clyybberAraq: Can you merge https://github.com/nim-lang/Nim/pull/11210, I accidently did that on my devel branch, and don't want to retrigger the CI wastefully when rebasing
14:14:38Araqclyybber: I don't like this parser extension. what's so hard about using a single doc comment?
14:15:30clyybberah, nothing, mratsim figured it should work so I just went with it
14:22:16Araqhttps://github.com/nim-lang/Nim/labels/Showstopper are important bugs that require your attention :-)
14:28:52FromGitter<mratsim> yeah I broke Github review system on your PR @narimiran
14:29:22narimiran@mratsim it's not your day, is it? :D first that wrong logic, now this.... :D :D
14:29:42FromGitter<mratsim> off by one are tricky to spot :P
14:29:55narimiranthat's why you were off by two :D
14:30:10clyybbertwo wrongs make one right, ... right?
14:31:09FromGitter<mratsim> C+ was one wrong, C++ is 2 wrongs? So???
14:34:10*PrimHelios_ quit (Quit: ZNC 1.7.3 - https://znc.in)
14:34:32clyybberC++ is always right, it can look into the void*
14:34:40*PrimHelios joined #nim
14:36:42clyybbermratsim: Good point there; https://github.com/nim-lang/Nim/pull/11203#pullrequestreview-235622993
14:37:08FromGitter<mratsim> I can't delete it :/
14:37:16clyybber:P
14:45:24FromGitter<jrfondren> if I define a $ for an object type, can I still access the default stringification of the object? I want to normally use a pretty representation, but have the option of seeing the 'raw' view
14:47:28leorizeuse repr() for that
14:47:33clyybberAraq: https://github.com/nim-lang/Nim/issues/9825 seems to be fixed
14:47:43leorizethe default `$` for object is terrible
14:47:55narimiranclyybber: :D :D
14:48:01Araqjrfondren. you can call system.`$`(x)
14:48:34FromGitter<jrfondren> ah ty
14:48:59Araqclyybber: compile with -d:useSysAssert -d:useGcAssert
14:49:07AraqI bet it's still wrong
14:49:11clyybberok, will do
14:49:22leorizeAraq: repr doesn't seem to work with newruntime
14:49:39Araqleorize: it's not ported
14:49:46*rnrwashere joined #nim
14:50:04Araqand I won't port it either, repr sucks and we should focus on important things
14:50:15Araqlike ... ensuring closures do work with --newruntime
14:54:19*rnrwashere quit (Ping timeout: 276 seconds)
14:55:10clyybberAraq: works with -d:useSysAssert -d:useGcAssert too. The only weird thing is that repr doesn't print a `@` on a seq which was converted from an array
14:55:24narimiranAraq: is https://github.com/nim-lang/Nim/issues/1286 still an open issue? i tried to reproduce it with some similar object and it compiles and runs both on stable and devel: https://play.nim-lang.org/index.html?ix=1IuX
14:56:03Araqnarimiran: yes, it's still an issue
14:56:48narimiranthen i over-simplified my example, i guess
15:12:02clyybberAraq: Fixing those out of order evaluations would require injecting temporaries in almost every case, as we can't anticipate the possible side effects of x = X(v: f(x.v))
15:12:27clyybberI think the C compiler will optimize those away, just making sure that this is the intended way to fix it right?
15:12:59*Minimisthupper quit (Quit: Connection closed for inactivity)
15:15:20FromDiscord_<hqm32> Hi! How do I parse a JSON string containing reserved words like `object` as keys and marshal it to a pretty data type? I need something like this: `jsonString.parseJson.to(MyResponseType)`. Thank you in advance!
15:19:46shashlick@narimiran I think the staticExec issue should be closed
15:20:06narimiranshashlick: me too, but i wanted to ask first
15:20:19shashlickDidn't someone add staticExecEx as well?
15:20:21Araqclyybber, no, the codgen should do an alias analysis check
15:20:30shashlickSynonym of gorgeEx
15:20:40Araqthe temps are only required if there is a possible aliasing
15:20:49Araqwe have code dealing with AA
15:22:38narimiranshashlick: it was an idea, but it isn't in index, so i guess gorgeEx is the only one
15:22:56narimiran(and IMO it is enough)
15:23:18clyybberAraq: Ok, does the alias analysis check also consider accessing globals as opposed to params?
15:23:30clyybberlike: x = X(v: f)
15:23:55clyybberwith: proc f():int = x.v
15:28:27FromDiscord_<treeform> @hqm32 you can't use the .to() function and you have to do it manually by walking the json structure and populating your own data structure.
15:29:11FromDiscord_<treeform> I wish to() had more features like key renaming and default key values but it does not.
15:32:28shashlickAgreed
15:37:46Araqclyybber, kind of, yes
15:38:13*PMunch joined #nim
15:39:46*PMunch_ joined #nim
15:42:51*PMunch quit (Ping timeout: 248 seconds)
15:45:33*seni quit (Quit: Leaving)
15:45:45FromGitter<alehander42> I wish I can map end
15:45:50FromGitter<alehander42> Ops
15:45:52FromGitter<alehander42> Nqma
15:45:55FromGitter<alehander42> Nqma
15:51:35*PMunch joined #nim
15:53:35*PMunch_ quit (Ping timeout: 246 seconds)
15:56:16*PMunch_ joined #nim
15:57:40*PMunch quit (Read error: Connection reset by peer)
16:01:53*laaron- quit (Remote host closed the connection)
16:04:48*laaron joined #nim
16:06:53*laaron quit (Remote host closed the connection)
16:09:14FromGitter<iffy> Is there an asyncnet equivalent to `recvFrom`? I want to make an async UDP server: https://nim-lang.org/docs/net.html#recvFrom%2CSocket%2Cstring%2Cint%2Cstring%2CPort%2Cint32
16:09:25*laaron joined #nim
16:10:19cy1iffy: check recvFromInto in asyncdispatch. Haven't looked to see if that's what you want, but...
16:10:54FromGitter<iffy> I think that might be it; let me try
16:14:00FromGitter<iffy> It wants me to provide an `AsyncFD` but I only have an `AsyncSocket`...
16:14:16cy1asyncnet's kind of weird, since asyncdispatch is the real "asyncnet," and asyncnet is just some extra networking stuff that uses asyncdispatch.
16:14:36*laaron quit (Remote host closed the connection)
16:14:39FromGitter<iffy> so should I try to just use asyncdispatch?
16:14:47cy1iffy: See newAsyncNativeSocket in asyncdispatch
16:15:19cy1asyncnet has stuff like buffering, so it's not entirely useless. I haven't yet made use of it though...
16:16:27cy1you can get the AsyncFD with asyncdispatch.newAsyncNativeSocket, then get an AsyncSocket for it with asyncnet.newAsyncSocket, if you need both.
16:17:02FromGitter<iffy> I'm just trying to make a echo UDP server
16:17:08*laaron joined #nim
16:17:35cy1yeah I've never uh... done that
16:17:45cy1so maybe asyncnet is useful
16:17:57FromGitter<iffy> I mean; a dummy UDP server (send it a string, it sends it back)
16:18:05FromGitter<iffy> a hello world
16:19:25cy1in particular, asyncdispatch uses raw pointers, which don't increment any reference counters, so if you pass a buffer to asyncdispatch.send, then await on that, the buffer could get collected before anything gets sent, without using GC_ref to hold onto it.
16:19:30euantorIIRC, UDP isn't properly supported in asyncnet
16:21:48cy1I dunno what "properly" is supposed to mean. UDP is basically... some funny socket options, not caring if the other side knows you're connected, and expecting anything you send to be potentially dropped and/or out of order. What needs to be done to support that?
16:26:54euantorI mean that there's no easy `sock.recvFromAsync` for an `AsyncSocket`
16:27:22euantorI'm not sure why it's not there, but it isn't. I also went looking for it in the past
16:29:05*nsf joined #nim
16:31:48FromGitter<arnetheduck> shashlick thats very cool! those llvm headers have plenty of nasty surprises lurking, specially the target-dependent stuff - for now, I've been dealing with it manually but editing that header file is somewhat annoying
16:32:18BitPuffinhmm can you somehow use nimscript as a library within nim?
16:33:44leorizeyea
16:33:54leorizenimble used to do that until recently
16:34:48FromGitter<arnetheduck> re comment styles, it would be really nice to have something better for field comments - placing the comment on the same line is ugly (no room to write a *useful* comment), and the hack with `##\` is annoying
16:35:21disruptekhere's a lib demonstrating UDP, but it's not async: https://github.com/treeform/netpipe/
16:35:24FromGitter<arnetheduck> ```field: Type ⏎ ## comment``` ⏎ ⏎ feels pretty natural with the rest of the language (indent it) [https://gitter.im/nim-lang/Nim?at=5cd456cc56271260f9326ab8]
16:38:31BitPuffinleorize: that's good, I was just not finding it in the library reference or anything, but I guess you could still pull it in as a library even if it's not part of "standard" library :p
16:40:32leorizearnetheduck: I used that syntax for document const
16:40:38leorizeit doesn't work for fields?
16:42:12FromGitter<arnetheduck> apparently not - https://nim-lang.org/docs/docgen.html#introduction-documentation-comments
16:42:36FromGitter<arnetheduck> it's quite annoying the way docs and comments are handled in the AST, leads to these quirks
16:44:05*PMunch joined #nim
16:45:22dom96euantor: It's not there because I didn't need it, and for some reason no one yet was brave enough to try and implement it
16:45:33dom96It should be just a low hanging fruit, I don't imagine it's too complex
16:45:41FromGitter<iffy> don't tempt me :)
16:45:52*PMunch_ quit (Ping timeout: 246 seconds)
16:47:11dom96just follow the implementation of asyncnet.recv, you can't go far wrong with that approach :)
16:48:33euantorNot complaining @dom96. There used to be a future version of Asyncnet that I’m sure had it, but I can’t find it now
16:49:09FromGitter<iffy> @dom96 k, and should the remote address/port be string/Port (like net.recvFrom)? or SockAddr/SockLen (like asyncdispatch.recvFromInto)?
16:49:34dom96asyncnet should mirror net
16:49:37dom96so the former
16:49:40FromGitter<iffy> k
16:49:48FromGitter<iffy> I'll see what time I have today; thanks!
16:50:02dom96SockAddr/SockLen is a low-level POSIX API thing
16:50:13dom96using those would be a pain
16:50:36dom96and that's precisely why you shouldn't use asyncdispatch directly :)
16:53:02*Vladar quit (Remote host closed the connection)
16:55:47travissI want to submit a PR to godbolt.com compiler explorer to support nim. He says there is some uncertainty about which gcc version it would use and doesn't want to have to support compiling with many versions (plus many versions of nim). What should we do here?
16:56:21travissJust pin to latest gcc?
16:56:36narimirantraviss: are you aware of https://github.com/mattgodbolt/compiler-explorer/issues/206 ?
16:56:39travisssorry, godbolt.org
16:57:19travissno, i should have looked first. thanks.
16:57:50narimiranbut your question is still valid, i just wanted to give you some historical perspective, so to say
16:57:54FromGitter<jrfondren> latest gcc, latest g++, done. that's the kind of options Nim wants.
16:58:09federico3iffy: string/Port or IpAddress/Port
16:58:16narimiranagreed with @jrfondren
16:59:14travissok, i will add to the issue letting them know
16:59:42narimirantraviss: if you can make a PR, that would be great
17:00:40narimiranbtw, v0.19.6 and v0.20 are around the corner, so maybe wait until they are released so we have the latest and greatest right from the start?
17:00:48travissJeez, did i say PR. Oops i meant a feature request. I wouldn't know where to start...
17:01:18narimiran:)
17:01:24FromGitter<mratsim> I was going to say wooooooooohooooooo
17:01:25FromGitter<jrfondren> well like it says in the issue narimiran linked, he's wanting someone to contribute it rather than ask him to do it
17:08:39*rnrwashere joined #nim
17:08:40travissI updated the issue. He is streaming now if anyone else wants to drop in: https://www.youtube.com/watch?v=TmNJ7aXBrDs
17:09:56*rnrwashere quit (Read error: Connection reset by peer)
17:10:10*rnrwashere joined #nim
17:14:31*rnrwashere quit (Ping timeout: 255 seconds)
17:15:32*xet7 quit (Quit: Leaving)
17:22:03clyybberAraq: Why did you drop https://github.com/nim-lang/Nim/commit/46b085d0918ebdd44fd0ecfa32494508aad8ea1a ?
17:22:55*PMunch_ joined #nim
17:25:15*PMunch quit (Ping timeout: 248 seconds)
17:35:09*theelous3_ joined #nim
17:37:01shashlick@arnetheduck do let me know how accurate the llvm wrapper turned out
17:37:47shashlickThere is one bug with renaming symbols I found - removing the LLVM prefix causes issues with enums with expressions
17:38:33shashlickIf enum2 = enum1 | something, if enum1 got renamed earlier, it isn't detected and fixed in the expressions
17:38:49shashlickFor now I've removed the renaming that you have in your wrappers
17:39:33shashlickIf we restrict the renaming to only procs, it might work but doubt that's how you have it
17:49:20FromGitter<arnetheduck> mm.. in the case of llvm, the enums should also not be enums, but simple int constants
17:49:41shashlickYa that's how nimterop works with enums
17:49:45FromGitter<arnetheduck> I didn't bother to fix that in the c2nim generated code, instead just commented out the offenders because I happen not to use them
17:49:47*hoijui quit (Ping timeout: 248 seconds)
17:49:53shashlickNo other reliable way to handle c enums
17:51:39FromGitter<arnetheduck> but yeah, stripping prefix should be done consistently, if done.. I'm of two minds about that - if I was aiming for a quality wrapper of that stuff, I'd leave the prefixes in the nimterop-generated code and would likely hand-write a nice nim-like interface on top without the prefixes, due to how nim dumps everyhing in the global namespace
17:55:45*Trustable quit (Remote host closed the connection)
17:59:04PMunch_Hmm, has anyone done I2C on the RPi boards in Nim yet?
18:12:06*hoijui joined #nim
18:12:22*hoijui quit (Remote host closed the connection)
18:21:42*sacredfrog quit (Ping timeout: 245 seconds)
18:23:55*sacredfrog joined #nim
18:31:18*sacredfrog quit (Ping timeout: 245 seconds)
18:32:55*sacredfrog joined #nim
18:36:12*PrimHelios quit (Quit: ZNC 1.7.3 - https://znc.in)
18:36:56*PrimHelios joined #nim
18:42:17*sacredfrog quit (Ping timeout: 246 seconds)
18:44:18shashlick@arnetheduck ideally nimterop makes it easy to generate idiomatic Nim with some niceties
18:44:43shashlickHow would you solve the global name space issue?
18:45:07*rnrwashere joined #nim
18:46:32FromGitter<liquid600pgm> what does this mean? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd475870824230a770884e8]
18:46:43FromGitter<arnetheduck> I'd say that works well for nothing but the simplest of libraries - the whole point of using a different language is to exploit features you don't have in the first one, so sure, some of it can be automated, but the end result I believe will be much better if you spend some time on curation as well - it's easier with some libraries though, if they were created with interoperability in mind
18:47:18*sacredfrog joined #nim
18:48:54FromGitter<arnetheduck> I don't know - generally, I'm not a fan of anything that defaults to global due to how short-sighted it is to write code that way.
18:49:11*PrimHelios quit (Quit: ZNC 1.7.3 - https://znc.in)
18:49:13FromGitter<arnetheduck> it's a language issue above all,nim doesn't offer too much in the way of modules and libraries
18:49:25*rnrwashere quit (Ping timeout: 246 seconds)
18:49:29*sacredfrog quit (Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac)
18:49:52*sacredfrog joined #nim
18:50:00*PrimHelios joined #nim
18:52:47shashlickWell I think there's definitely space for some interop helper procs
18:53:48shashlickMake it easier to deal with pointers, arrays, etc
19:00:05FromGitter<arnetheduck> well, in llvm you have plenty of opportunities to experiment :) they do lots of stuff that takes some curation (like the way strings and memory allocations are handled), even though the C library specifically is designed for interop
19:01:05FromGitter<liquid600pgm> figured it out, turns out you can't have proc arguments like `(height: Natural, width = height)`
19:01:14FromGitter<liquid600pgm> that's kinda lame
19:01:26FromGitter<arnetheduck> I'd generally not recommend using C++, ever, for interop, unless it's some crippled C++ that only uses a bare minimum of actual C++ - much easier to write some C wrappers and export those, @mratsim - for example, that's what all of rust, zig etc do with llvm, and for good reason
19:02:03ZevvPMunch_: I did, not on the Pi though, but the interface is the same everywhere
19:02:09FromGitter<arnetheduck> ie the successful integration of two languages generally takes some work on both ends to be *nice*
19:02:48ZevvFrom userspace the common way is to open /dev/i2c-X and doing some ioctls
19:02:58*PrimHelios quit (Quit: ZNC - https://znc.in)
19:03:21Zevvi2c-dev.h has all you need
19:06:18*PrimHelios joined #nim
19:07:10FromGitter<felipetesc> Hello there. I created an app for windows using webview and I want to change the icon from the title bar , as well, the app icon. I'm using mys2/mingw64, and I want to know if there is a cmd or a convenient way to help me. I've Google it , bye the way. Places I found something: https://forum.nim-lang.org/t/1862 , https://khchen.github.io/winim/winim.html , https://nim-lang.org/docs/niminst.html
19:09:22*sacredfrog quit (Quit: WeeChat 1.9.1)
19:10:31PMunch_Zevv, aah right
19:10:50PMunch_For now I've just used Python, found some simple code that worked for what I needed
19:11:52PMunch_I put an RPi with a speaker and an accelerometer on top of my robo-vacuum. When the accelerometer detects a hard stop ie. a crash, it plays quotes from Marvin the manically depressed robot from hitchhikers guide to the galaxy :D
19:12:32*rnrwashere joined #nim
19:12:39Zevv"this terrible pain in the diodes down my side"
19:14:11ZevvI do embedded for a living. I love and I loathe how people waste hundreds of MHzs and MBs on silly projects that could be donw with some discrete electronics or a $50 ARM :)
19:14:23Zevv$0.50 ARM, that is
19:16:02clyybberAraq: I fixed one of the showstoppers: https://github.com/nim-lang/Nim/pull/11216
19:16:55clyybberbut it doesn't account for the case that the proc might access something of the lefthandside object through a global or something
19:17:08*rnrwashere quit (Ping timeout: 245 seconds)
19:18:46clyybberliquid600pgm: Huh, really? I thought that was supposed to work :/
19:20:53clyybberPMunch_: Haha, thats amazing.
19:21:34PMunch_Zevv, yeah I know.. But I didn't have any Arduino sound boards lying around..
19:22:18PMunch_I literally threw in together in about an hour or so
19:22:27Zevvthat's the fun of these cheapo boards
19:22:49PMunch_If I'm going to make it a permanent solution I'll definitely be getting some hardware that's a bit more apt for this
19:23:25clyybberI remember a year ago or so, there was a robo-lawnmower in our city that somehow came off the lawn and went on the street through the whole city for a day
19:23:42ZevvThe downside is that it takes a lot of the magic of my job away. It used to be voodoo to most people :)
19:23:49PMunch_TBH I think a finished unit that just played random tracks from an SD card whenever it bumped into something would be quite popular on Kickstarter
19:23:50clyybberand then it died (or rather its batteries)
19:24:06clyybberZevv: Do you do FPGAs?
19:24:13Zevvincidentally
19:24:26clyybbernice. those are *magic* to me
19:24:48Zevvbasically just for interfacing stuff, but SOC's come with amazing programmable bus peripherals these days, so less common
19:25:11ZevvThey always were like magic to me. Large part of the confusion comes from the opaque tooling.
19:25:42ZevvIf you want to get down and dirty, open up the tools, extract the command line binaries and run everything by hand.
19:26:15ZevvIt takes time, but it all makes sense once you get it running. Plus; I hate IDE's, so now I can do FPGA's with vi and Make
19:26:32*nsf quit (Quit: WeeChat 2.4)
19:27:20*xet7 joined #nim
19:31:27clyybberI remember reading some paper where they somehow leveraged interference on FPGA's to train a neural net or so
19:32:31clyybberdamn it, I cant find it
19:35:54Zevvprobably a good match. A lot of repetative simple circuits
19:36:57ZevvAn FPGA is basically nothing then rewireable hardware. There's a lot of basic building blocks consisting of a handful of fets, and the bitstream defines the connections between those.
19:37:30*rnrwashere joined #nim
19:37:43dom96@felipetesc: In general whatever works for other compiled languages should work for Nim too, the links you've found are good. I'm afraid I don't have any other pointers to give you
19:41:47*rnrwashere quit (Ping timeout: 248 seconds)
19:42:26*PMunch_ quit (Remote host closed the connection)
19:43:00*PMunch_ joined #nim
19:46:09*narimiran quit (Remote host closed the connection)
19:46:43*PMunch_ quit (Remote host closed the connection)
19:48:33FromGitter<mratsim> @felipetesc, when you say webview, do you mean this package? https://github.com/oskca/webview
19:48:37shashlick@arnetheduck are you suggesting I not bother adding c++ wrapping to nimterop and continue improving the C wrapping
19:49:12FromGitter<mratsim> @arnetheduck I would prefer the C bindings as well but I know that for the OrcJIT the C bindings are a bit behind in term of functionality
19:50:01shashlickIf you have some good examples of generic Nim to c niceties, I'll be eager to add them into nimterop
19:50:03FromGitter<mratsim> I have the time though, apparently to do polyhedral compilation I have to first create a math/constraint solver in pure Nim
19:50:06FromGitter<arnetheduck> @mratsim yeah, the c bindings lag a bit sometimes - what I've found is that sometimes the other projects have "tentative" versions that they later upstream.. like debug info API was prototyped in `rust` then upstreamed to llvm
19:50:39FromGitter<arnetheduck> so I first copied them from rust to nlvm, and removed slowly as they got added upstream :)
19:52:08cy1if you want to say a = b, where "a" and "b" are different types, is there... any way to write something to automatically convert the value, or do you always have to write something like a = convert(b)?
19:52:58FromGitter<mratsim> use converters
19:53:01rayman22201https://nim-lang.github.io/Nim/manual.html#converters
19:53:25cy1Of course. Thanks!
19:58:54FromGitter<arnetheduck> shashlick, C++ is a complex language with many features that nim simply doesn't have -> hard to interface with it decently, and lots of bugs and corner cases.. however, exporting c++ to c from within c++ is easy. depends what your goals and use-cases are though. I find it a bit of a fools errand to go in that direction because I wouldn't be satisfied with some half-assed support, though I know many nimmers disagree
19:58:54FromGitter... because they managed to port / use some simple c++ code that exposes just a limited API based on some msvc6-compatible version of c++98..
19:59:52cy1plus then you're not encouraging people to keep using C++...
20:00:46*vivus joined #nim
20:02:49vivushello all. Does anybody use the csvtools library? I am trying to run the basic example at the top of the file, but I am getting an error: file.nim(4) file ... system.nim(2918) sysFatal ... Error: unhandled exception: index out of bounds [IndexError]
20:02:54clyybberarnetheduck: I agree. I dislike most cpp APIs in general tho
20:03:29clyybbervivus: No, but I'd suggest simply writing a csv parser yourself.
20:04:07vivusclyybber: isn't that re-inventing the wheel? the lib already exists and I just need to extract data from the csv
20:04:55clyybberhmm, yeah. I like to roll my own solutions often because some libraries are kinda overkill
20:04:58FromGitter<arnetheduck> I like C++ - a lot actually - specially the more recent versions that allow you to write good code :) but that looks nothing like earlier stuff - gone is manual memory mgmt, the clunky struct functors, poor compromises in argument passing etc - modern C++ is surprisingly nice, if you take advantage of it
20:05:55clyybberarnetheduck: thats true. But with modern cpp I always end up in []{}()-hell
20:07:26clyybberarnetheduck: What is kinda sad, though, is that so many projects are not even using the once pragma, because they like to support gcc versions from aeons long past
20:07:34FromGitter<jrfondren> @vivus, that's that index error. probably the csv you're working with doesn't have 5 columns.
20:07:52clyybbers/once pragma/any convinient new cpp feature
20:08:21cy1C++ is hard to compile, takes a ton of memory to do so, and a long time.
20:08:37cy1The language itself is eh... yucky, but the compilation time really kills it for me.
20:08:40FromGitter<arnetheduck> well, technically `pragma once` is not part of the standard which is why some / many projects avoid it
20:08:41FromGitter<jrfondren> @vivus yeah that example works fine for me with a suitable myfile.csv
20:09:18FromDiscord_<kodkuce> i alwies wanted to lern proper C++ but evry step is some doom and worst ghing there is no proper turtorial that says this is old stuff this is modern stuff
20:09:30vivus@jrfondren so the issue is with csvtools lib?
20:09:51clyybbercy1: ccache does wonders.
20:09:54FromGitter<jrfondren> @vivus no, the example assumes that you have a file with 5 columns
20:10:12FromGitter<jrfondren> @vivus if you have fewer columns, do something appropriate for your .csv
20:10:23cy1clyybber: not the first time you compile it!
20:10:38clyybberyeah
20:10:58clyybberwithout ccache I would have gone mad compiling wine
20:11:30FromGitter<mratsim> don't compile chromium then ...
20:11:42FromGitter<arnetheduck> not that nim is much better - the only thing that saves it is that nim programs are small :) imagine openoffice or firefox in nim, and recompiling all code every time
20:12:00FromGitter<mratsim> My main grip with C++ is compilation and the utter lack of sane package management
20:12:04cy1Yeah I'm not a big fan of Nim's lack of linking
20:12:11FromDiscord_<kodkuce> i alwies wanted to lern proper C++ but evry step is some doom and worst ghing there is no proper turtorial that says this is old stuff this is modern stuff
20:12:11FromDiscord_<kodkuce> anyway hopfully if i learn Nim i wont need C++ anymore
20:12:36FromGitter<mratsim> every time I want to try a C++ library I get into CMake issues, even mature packages like OpenCV
20:12:54clyybbermratsim: I'm glad I won't. happy waterfox/firefox user
20:13:07FromGitter<mratsim> firefox is also insane to compile
20:13:31cy1arnetheduck: Imagine the time it would take to compile Firefox rewritten in rust! oh wait
20:13:36FromGitter<arnetheduck> kodkuce, to master the art, learn a few languages that are different along some important axes (static, dynamic, functional, OO etc).. each new one you learn will make you better at your "home" language as well, whichever that ends up being.
20:13:52FromGitter<mratsim> Yeah, go try Haskell
20:13:53FromGitter<arnetheduck> cy1 well at least they solved @mratsim 's gripe with tooling :)
20:14:05FromGitter<mratsim> the hardest thing for me in haskell when I started was reading a file
20:14:12FromDiscord_<kodkuce> i learned first c# , then python , and i tryed little nim and basic C
20:14:16FromDiscord_<kodkuce> i learned first c# , then python , and i tryed little nim and C
20:14:26FromGitter<arnetheduck> in haskell everything is equally hard :)
20:14:29cy1yeah, rust has cargo which is okay. I forget if cargo does source packages or binary ones though.
20:14:51FromGitter<arnetheduck> source mainly.. I think you can do binary as well, with some hacking
20:14:52clyybbersource
20:15:00FromGitter<mratsim> cargo is good, better than nimble at the moment to be honest
20:15:35clyybberwhen it comes down to it, gitsubmodules are the best :)
20:15:49cy1Wish Scheme didn't have that nasty call/cc requirement, makes any implemenations of that language pretty tricky and slow.
20:15:50clyybberreproducible, non-buggy, portable
20:15:50FromGitter<mratsim> :thinking_face:
20:16:08cy1I wonder how Racket's doing lately...
20:16:14FromGitter<mratsim> it's buggy when you collaborate because they work strangely in branches
20:16:19clyybbercy1: pretty great
20:16:55cy1clyybber: they're still writing syntaxes of syntaxes of syntaxes of syntaxes?
20:17:22clyybberyeah. I wrote a roguelike in racket, and made my own small dsl for it.
20:17:44clyybberit really pushes you to write your own "language"
20:17:51FromGitter<mratsim> Oh, Spry lang website is back: http://sprylang.se
20:18:45rayman22201They are rewriting the whole racket runtime in chez scheme, so yeah, more schems on schemes lol
20:19:26cy1clyybber: I just wish they were better at keeping the intermediate representations clean. It's hard to understand code, when you have to compile syntax transformers in your mind to do so.
20:20:48clyybberyeah
20:21:25cy1I seem to remember something like (expand-macro (some-simple-thing)) => (holy-crap-brain-anyeurism)
20:22:30clyybbermratsim: sadly they dont support precedence for those infix/prefix functions
20:23:13vivus@jrfondren " do something appropriate for your .csv" > what if the CSV file is like 5M lines? transforming it won't work
20:23:38FromGitter<jrfondren> @vivus, you don't need to transform it. you just need to not ask it for a fifth column if it doesn't have five columns.
20:23:54FromGitter<mratsim> @vivus, have you tried stdlib parsecsv? or Nimdata?
20:24:06FromGitter<jrfondren> @vivus, try that example with row[0]
20:24:10*shadowbane quit (Quit: Konversation terminated!)
20:24:14clyybbermratsim: hmm, never used submodules extensively in branches. I always had the submodules updated directly on the master branch
20:24:42*jjido joined #nim
20:25:09FromGitter<mratsim> We have submodules in our repo at Status and I always have to take care to not apply the latest one along my commits when I switch branches
20:27:17clyybberbut why does the submodule always update on your clone?
20:27:28clyybbernormally updating submodules is done manually.
20:27:58*shadowbane joined #nim
20:29:08FromGitter<mratsim> when you update a submodule, all branches see the update one, if you commit all you will commit the submodule update.
20:29:10clyybberunless you use --remote to update your submodules, because it then skips right past the commit hash specified in the root rep
20:29:43clyybbermratsim: oh, yeah. thats an issue.
20:29:48FromGitter<mratsim> no try it, create an empty repo, crate a branch, and add a submodule in the branch. switch to master, it doesn't disappear
20:30:13shashlick@arnetheduck I'm limiting nimterop to wrapping only and not outright conversion, with that in mind, what's wrong with wrapping c++ header files?
20:30:15FromGitter<arnetheduck> well, to get "correct" behaviour with submodules, you need to `git submodule update` on your main repo.. if you work with branches on the subrepos, you need to replicate those branches on main repo as well and it quickly creates a very messy workflow with lots of branches everywhere that few people understand well how to manage, specially when merging
20:31:26FromGitter<mratsim> @shashlick, nothing wrong but you will have to do more plumbing than C (which always works once wrapped)
20:31:34FromGitter<arnetheduck> shashlick there's nothing wrong, it's just that you'll never arrive at a working solution, beyond hello world and c++98 :) try it on.. an average boost library, and you'll see.
20:32:17FromGitter<mratsim> some example: https://github.com/status-im/nim-ttmath/issues/10, https://github.com/status-im/nim-ttmath/issues/14
20:32:53FromGitter<mratsim> "flexible array member type", "Type has a non-trivial destructor" https://github.com/status-im/nim-ttmath/pull/15
20:33:43FromGitter<mratsim> Every new guy onboarded had issues one way or another with ttmath which was a C++ header only library.
20:34:14FromGitter<alehander42> i am sorry that i started this ttmath thing :D :D
20:34:28FromGitter<alehander42> (ttmath-wrapper) maybe not a good idea in hindsight
20:34:45FromGitter<mratsim> lol
20:35:12FromGitter<mratsim> I think it was, it's used a lot on embedded device stuff like mbed, it's fast, and it has a good license
20:35:26clyybbermratsim: Yeah, I guess running git submodule update each time after switching a branch is kind of bothersome..
20:36:19FromGitter<mratsim> The C alternatives would have been imath (often used as an alternative to GMP) or libtommath (used in libtomcrypt) I think
20:36:48FromGitter<mratsim> We do need a bigint lib in the stdlib
20:36:55FromGitter<dom96> Huh. I didn't realise submodules has such issues
20:38:08FromGitter<dom96> Surely there must some reasoning behind this behaviour. Anyone know what it is?
20:38:16clyybberdom96 probably because "back then" they thought it would be unreasonable to change the actual folder contents of the submodule each time you switch to a branch with a different version of the submodule
20:38:30clyybberbecause of disk space or something like that?
20:38:48clyybberdom96 I wonder how easy it is to contribute to git
20:39:00clyybbermaybe add an option that changes that behaviour
20:40:11FromGitter<arnetheduck> submodules are generic, package managers are language-specific. you get the better ux because you cut down on genericity and make more implicit assumptions that work well when you're serving the "build" workflow
20:43:33FromGitter<dom96> I don't see disk space as a satisfactory explanation. The repo is already there
20:45:37FromGitter<arnetheduck> generally, if you switch branches in git it will only touch the changed files, meaning that with a decent build system, you will only rebuild the difference..
20:47:04clyybbernarimiran[m]: hey, you there?
20:47:15dom96It appears that Git 1.8.2 allows submodules to track branches
20:47:17FromGitter<arnetheduck> depending on your workflow, you either want or do not want the submodule to follow.. for most modern toolchains, you mostly want the submodule to follow, but that's not obvious, and changing it now would break a lot of existing setups.. regardless, it's usually a pita, and most projects avoid submodules if they can, going for monorepo instead
20:47:20dom96No idea if that's what is missing here
20:47:27dom96but stackoverflow answers seem to be mention it
20:47:57dom96Why don't you go for a monorepo?
20:49:08clyybberdom96 it means that you can track branches of the submodule.
20:49:09FromGitter<arnetheduck> poor tooling support in nim.. though we're moving in that direction now that we've dropped nimble
20:49:33Araqclyybber: please don't use [CI skip], it confuses me
20:49:43Araqnow I have no clue what's been tested
20:50:10clyybberAraq: Sorry, you can click on the small red x next to the commit
20:50:29clyybberand a popup with the checks will appear
20:50:56clyybberAraq: next to the "Add testcase" commit
20:50:59clyybberthe CI's did run
20:51:14Araqall Nimble packages green too?
20:51:19dom96arnetheduck: I'm not sure it's worthwhile to support "local packages" in Nimble's dep list when you can easily just specify the path in your nim.cfg file
20:51:42dom96and once you do that, yes, you don't really need Nimble
20:51:48clyybberAraq: github timed out while testing those, again.
20:51:53FromGitter<mratsim> Monorepo support is important, even Google is using a monorepo
20:52:12FromGitter<alehander42> monorepos make sense for bigger projects
20:52:28clyybberAraq: Thats why so many PRs are red, github has some serious issues with their servers apparently
20:52:43dom96I should know, I work at a pretty big company that doesn't use Git because of the size of their monorepos...
20:52:47FromGitter<mratsim> Yeah, and Appveyor gives you green even if you have failures
20:52:48FromGitter<jrfondren> their servers were time-travelling the other day.
20:53:28FromGitter<mratsim> Rust is investigating new CI options by the way and have good experience with Azure Pipelines
20:53:32clyybbermratsim: Are you sure? https://ci.appveyor.com/project/Araq/nim/builds/24432914 is red
20:53:34FromGitter<arnetheduck> well, we wanted to be good nim community citizens and publish as much of our work as possible on nimble so it would be easy to reuse - that unfortunately cost us a lot of time and frustration - but you're right, we can get by without nimble too.
20:53:55FromGitter<mratsim> @clyybber, yes sure, we raised an issue directly with appveyor a day ago
20:54:04clyybberah, ok
20:54:27*krux02 joined #nim
20:54:40FromGitter<mratsim> See for example: https://ci.appveyor.com/project/nimbus/nim-chronicles/builds/24391980/job/gylc2q52m91wms8h#L1378
20:54:53Araqclyybber: so ... merge it?
20:55:17Araqhttps://github.com/nim-lang/Nim/pull/11216 I mean
20:55:45dom96arnetheduck: I understand. Indeed, for this use case Nimble support would be useful
20:56:09clyybberAraq: Yeah, I guess so
20:56:22dom96If you're up for it, hacking this into Nimble should be relatively trivial
20:56:45FromGitter<jrfondren> @arnetheduck so what would the ideal look like? you have a project .nimble that describes more than one project that live in different subdirectories, and someone can "nimble install" them individually without pulling in the other stuff?
20:57:58FromGitter<mratsim> My 3 pet peeves regarding nimble are: ⏎ ⏎ 1) task level dependencies ⏎ 2) please don't remove the src folder when doing nimble install, keep the src as it was on the dev box ⏎ 3) don't warn about incorrect structure for extra directories, that's scary to newcomers [https://gitter.im/nim-lang/Nim?at=5cd49456e7f42160fa601fb0]
20:59:06FromGitter<mratsim> And more fuzzy stuff about versioning vs head vs master, and also multiple nimble packages in one repo.
20:59:24dom96@mratsim: you might not like 2&3, but what are the alternatives? We cannot allow people to install whatever they please.
20:59:29krux02mratsim: I don't like that the recommended structure for nimble packages changed quite a few times.
20:59:56krux02dom96, why not?
21:00:06shashlick@dom96 the whole problem is that all packages are added to the same namespace
21:00:11FromGitter<mratsim> 2 gives you hack like these: https://github.com/nim-lang/nimble/blob/v0.9.0/nimble.nimble#L4-L9
21:00:30krux02isn't that the point of package managers, to install whatever the people please to package?
21:00:36FromGitter<mratsim> When even nimble needs to hack around the fact that "src" disappears when installed, it's quite telling
21:00:41shashlickInstead of should have been pkgs/package-x.y.z/package
21:00:59shashlickThat way importing packages would have been in their own package namespace
21:01:17shashlickThey can do whatever in their subdirs
21:01:27dom96So I install `src/nimblepkg/nimble.nim` to `pkgs/nimble-0.9.0/`, what then?
21:01:31FromGitter<mratsim> also this "src" hack probably doesn't even work with "nimble develop"
21:01:39dom96I import it via `src/nimblepkg/nimble`?
21:01:49dom96mratsim: it does
21:01:50krux02installing a nimble package should just be a shallow git clone
21:01:59FromGitter<mratsim> agree with krux
21:02:29*rnrwashere joined #nim
21:02:29Araqclyybber: https://github.com/nim-lang/Nim/issues/11217 if you want to help... These are fun to work on, IMO, ymmv
21:02:34dom96I think you are all making an assumption: that the Nim compiler reads the .nimble file
21:02:49krux02no I don't
21:03:01dom96Then how do you handle the problem I am describing?
21:03:03Araqmratsim: I want to give you module-specific .passC pragmas
21:03:17FromGitter<mratsim> nimble is free to add a .cfg file in the directory
21:03:26krux02I would like to make the nimble file obsolete
21:03:30FromGitter<mratsim> @Araq, I need file-specific, not module specific
21:03:35krux02at least for most use cases
21:03:41shashlickpath should have been --path:~/.nimble/pkgs/package-x.y.z like it is today but all contents go into ~/.nimble/pkgs/package-x.y.z/package
21:03:54shashlickso all imports would have to be `import package/whatever`
21:03:55FromGitter<mratsim> otherwise when I compile with AVX for example it will produce wrong SSE code (not backward compatible)
21:03:57Araqmratsim: what's the difference? A module produces a c(pp) file
21:04:07FromGitter<mratsim> ah ok
21:04:07clyybberAraq: https://github.com/nim-lang/Nim/issues/9684 has been fixed too.
21:04:15FromGitter<mratsim> I had package in my head
21:04:17dom96shashlick, okay, but then I cannot `import jester` anymore
21:04:37Araqclyybber: to close bugs, add a test case and use "closes #xx" instead of "fixes #xx"
21:04:56Araqdom96: yeah but that's about it.
21:04:58FromGitter<mratsim> @dom96 I think that is a tooling problem
21:05:02shashlick@dom96: yes that is right, but that's how it should have been
21:05:06krux02Araq, what closes instead of fixes?
21:05:14shashlick`import jester/jester` or whatever
21:05:17clyybberAraq: yup will do. I didn't realize I fixed that issue too, it was more of an *accident*
21:05:26krux02github doesn't care as far as I know and "fixes" seems to be already the convention
21:05:35dom96This still wouldn't be a "shallow clone" though
21:05:44Araqno, the convention is fixes for fixes, closes for closes
21:05:47dom96You wouldn't be able to put your files into a `src` folder
21:06:21dom96But listen, for real, if you guys have a good thought in your head about how this should work please write an RFC
21:06:23FromGitter<mratsim> it's still a tooling problem. I think it's a bad idea to push tooling issues to devs
21:06:38*krux02 quit (Remote host closed the connection)
21:06:47dom96Then we can clearly talk about the problems and the solutions
21:06:55shashlickput files wherever, that shouldn't be nimble's problem - nimble should be providing a way to get a package installed
21:07:01dom96Each of you have a different concept of what you want and are missing problems from what I can tell
21:07:05*rnrwashere quit (Remote host closed the connection)
21:07:12shashlickif packager wants src, then `import jester/src/jester`
21:07:12FromGitter<mratsim> I'm pretty sure many who used the "src" way were puzzled by strange bug report because the library didn't work after nimble install
21:07:16Araqdom96: no, we all want the same
21:07:38shashlickif it is not stdlib, it should be in its own namespace so it doesn't interfere with others
21:07:52FromGitter<jrfondren> shashlick's wants are definitely out of step.
21:07:59shashlickif you want import jester, get it into the stdlib, convince the stdlib maintainer
21:08:02dom96Araq, I seriously doubt that
21:08:03Araqdon't butcher the directories, yes that might mean 'import jester / jester', you'll survive
21:08:19FromGitter<mratsim> What I don't want are these kinds of bug: https://github.com/mratsim/Arraymancer/issues/16
21:08:44FromGitter<felipetesc> @mratsim Yes. Exactly.
21:08:48FromGitter<mratsim> and the RFC is there: https://github.com/nim-lang/Nim/issues/6700
21:08:56dom96mratsim: seriously, this is a hack, it was always a hack
21:09:03dom96I didn't want this way of reading the version
21:09:08dom96I'm perfectly happy to duplicate it
21:09:24shashlickone hack is to handle `import jester` as first looking for jester.nim as is, then when not found, in jester/jester.nim for backwards compatibility
21:09:51shashlickbut perhaps complain that it will be deprecated eventually
21:10:28FromGitter<felipetesc> @FromIRC Thanks.
21:11:06dom96Araq, you'll end up with repos that have all the .nim files in the root
21:11:16FromGitter<mratsim> the worse is that at the time I had Travis and Appveyor set up and it never cropped up into CI
21:11:18noonienwhat is a nim project?
21:11:20dom96or having to import using `import jester/src/blah`
21:11:59dom96mratsim: What was the problem? Was it that you used this in your .nimble file?
21:11:59FromGitter<mratsim> well many are avoiding the src structure and use project.nim and project/ because src is not reliable
21:12:33nooniencan anyone link a well-structured nim project? preferably one that builds to multiple binaries
21:12:40dom96mratsim: yeah, and do you really want to `import project/project/module`?
21:12:54shashlickwhat's wrong with having nim files in the root?
21:12:57shashlickif it is a library
21:12:58FromGitter<mratsim> As I said this is a tooling path/resolution problem
21:13:12FromGitter<arnetheduck> @jrfondren an minimally sane setup would start by not ever using or recommending `nimble install` - that's a fundamentally broken concept. it would support repro builds, so that when I give you a project, you successfully build it every time, again regardless of what you happen to have installed. it would be local to the project, so I can work on two projects concurrently and not worry. it would build what's
21:13:12FromGitter... necessary/changed and no more so I don't have to waste time. it would promote good community behavior so that it's easy to perform socially beneficial tasks like sharing code asynchronously. it would sport good monorepo support with relative dependencies so that that I can give structure to a larger project but still mai ... [https://gitter.im/nim-lang/Nim?at=5cd497e85a1d435d4613e3d6]
21:13:14FromGitter<mratsim> it's not one or the other
21:13:21FromGitter<mratsim> @dom96 this was the issue: https://github.com/mratsim/Arraymancer/commit/1486d432f509270fc5ff14c3cea87f887e523c7d#diff-8f67a9879fcc256856a21ea81896516e
21:13:25FromGitter<mratsim> well the fix
21:13:40dom96shashlick, it makes the repo messy
21:14:08FromGitter<mratsim> I think we should trust users to be grown up
21:14:11shashlickwell only top level nim files will be in the root, everything else can be in subdirs and imported relatively
21:14:20FromGitter<jrfondren> sounds like another way to state the problem is: src exists in the devel environment and thereby allows people to refer to it in ways that break after installation.
21:14:23dom96mratsim: You had arraymancer.nim outside the `src` dir?
21:14:31FromGitter<mratsim> yes
21:14:44dom96Why did you expect that to work?
21:14:59FromGitter<mratsim> like many other projects, at the time I didn't know about the difference between arraymancer.nim and arraymancer/ or the src/
21:15:10FromGitter<mratsim> because no documentation?
21:15:19FromGitter<jrfondren> @dom96 the problem is it did work :)
21:15:32dom96jrfondren: what? It never did
21:15:36Araqremember that Nimble's design predates import dir / [a, b, c] and now that we have that, Nimble can be simplified
21:15:52clyybberAraq: Destructors for global vars should just be injected at the "end" of the program, right?
21:16:00Araqclyybber: yep
21:16:01dom96oh, I guess you didn't have `srcDir= "src"` in your .nimble file?
21:16:04FromGitter<jrfondren> it worked until someone nimble installed. with no warnings from nimble about how things wouldn't work at that point.
21:16:10FromGitter<mratsim> I just looked into other projects mostly andrea linalg and it worked like that: https://github.com/unicredit/linear-algebra
21:16:32FromGitter<mratsim> it doesn't have srcDir as well
21:16:40dom96yeah, and it works, doesn't it?
21:16:43Araqand whether 'src' ends up in my import statements is a non-issue if that's what it takes to make Nimble more reliable
21:17:04FromGitter<mratsim> well, I had 3 months or Nim at the time
21:17:35FromGitter<mratsim> That's the kind of friction you don't want on new people
21:17:38Araqand it would make Nimble more reliable because currently we have 2 different directory setups, nimble only copies 'src' over into $nimbledir
21:18:23shashlickokay then are we all saying that nimble should add --path:~/.nimble/pkgs/package-x.y.z to the search path like today and nimble will install everything into ~/.nimble/pkgs/package-x.y.z/package to keep unique namespaces but nim will translate `import package/file` to `import package/src/file` so that the repo is clean
21:18:34Araqand then in the Nimble tasks you can have lovely checks like "am I in the .nimbledir already or not..."
21:19:07dom96yeah, because you run the Nimble tasks so often when the package is installed
21:19:10shashlickand package maintainer will put all files they want importable into src
21:20:02clyybbershashlick: sounds great
21:20:46Araqshashlick: still too complex for me, but I'm willing to make compromises if only we can solve this for good
21:20:47dom96shashlick, honestly I would have no problems with this, you have to convince Araq to let you do this import stmt transformation though
21:21:18dom96but let me just ask you: is this implicit transformation really less complex than what we have now?
21:21:26dom96At least right now you can check what Nimble installs
21:21:32noonienare there any nim projects i can look to for inspiration for a project structure? my projects will be building several binaries
21:21:32dom96There is no magic
21:21:44dom96noonien, https://github.com/nim-lang/nimble#project-structure
21:21:51FromGitter<mratsim> for now I just want nimble not to delete the src in the path.
21:22:08noonieni also would prefer to have a way to get rid of imports such as `import "../foo"`
21:22:16shashlick@noonien - see nimterop/nimterop and genotrance/feud
21:22:18dom96mratsim: why don't you just not have the `src` dir at all?
21:22:36shashlicki agree i don't like the magic but we are talking about cleaner repos so it is a compromise
21:22:44FromGitter<mratsim> Or why don't I just not use nimble/nim at all?
21:22:45nooniendom96, shashlick: thanks!
21:22:57shashlickhonestly, it should be the package maintainer's option to figure out how they want to use the namespace
21:23:14shashlickideally you have one nim file in the root dir that imports everything else
21:23:29clyybberwhat does nimble use atm? --path:~/.nimble/pkgs/somepackage/ and append the srcDir to that?
21:23:31shashlicki don't like the src magic
21:23:31dom96mratsim: Ouch. I'm just trying to help you man
21:23:33FromGitter<mratsim> that's what i had in Arraymancer
21:23:47FromGitter<mratsim> one file at the root which imported everything
21:23:48FromGitter<jrfondren> @mratsim you want src/ because you referred to src/ once, then discovered that didn't work, then stopped referring to src. if it were made to work your code would have to refer to src again, and someone else would say "for now I just want nimble to delete the src in the path"
21:24:01Araqthe package manager should do 'git clone' followed by a 'git checkout', nothing more, nothing less
21:24:04FromGitter<jrfondren> @mratsim I feel like the more fundamental problem is that you did it wrong once, and people shouldn't be steered down that path like you were
21:24:55FromGitter<mratsim> I actually still have src in Arraymancer, I just move the root file in the src dir but in exchange I have invalid package structure
21:25:12FromGitter<arnetheduck> shashlick, go to `cargo` for inspiration - the most significant magic they have is how well it works :)
21:25:13FromGitter<mratsim> my other packages don't use src anymore though
21:25:35FromGitter<jrfondren> and the 'steering' there is just that the installation environment differs from the devel environment and nimble doesn't complain when you depend on stuff that changes, and that maybe the docs aren't good enough.
21:25:37clyybberI don't get the problem, just use srcDir = "src" ?
21:26:21FromGitter<mratsim> @clyybber the problem is that unsuspecting package first author will get these reports: https://github.com/mratsim/Arraymancer/issues/16
21:26:22FromGitter<jrfondren> @arnetheduck I thought you were thinking mainly of npm. maybe that's similar to cargo
21:26:39Araqthe fact that the installation environment differs from the devel environment is Nimble's design bug number one. It's *begging* for bugs and problems
21:26:43dom96Some of you guys are really making me sad
21:27:05clyybbermratsim: Ah, I see.
21:27:38dom96Please keep in mind that Nimble is a result of almost a decade of (volunteer) work and that many compromises were made
21:27:41FromGitter<arnetheduck> dunno never used npm extensively - the thing I heard about it was that it was pretty broken, then `yarn` came along and did a decent job, then `npm` learned from `yarn` and fixed their own stuff
21:27:48FromGitter<jrfondren> isn't it just this one bug and problem? You could put that in a "CAVEATS section
21:27:48FromGitter<mratsim> So you have fancy CI, spend a lot in documentation, you announce v1 of your package, and then "nothing to install"
21:28:24FromGitter<mratsim> It's not one bug, it's plenty of workaround that lie in wait like this: https://github.com/nim-lang/nimble/blob/v0.9.0/nimble.nimble#L4-L9
21:28:49FromGitter<jrfondren> @arnetheduck all I know about npm is that you have to pass it a flag to have it install stuff the way nimble does. the default is to install into a subdirectory of your project
21:28:55FromGitter<mratsim> `fileExists(thisModuleFile.parentDir / "src/nimblepkg/common.nim")` this is really a hack
21:29:00clyybberdom96: hey, I think most people here appreciate your work and nimble and thus want to have it be as best as possible
21:29:07FromGitter<arnetheduck> @jrfondren that's a good and sane default to have, indeed
21:29:26FromGitter<mratsim> @dom96, the goal is not too make you sad, it's to make nimble better and to reduce friction when developing for Nim
21:29:53FromGitter<mratsim> The things Nim lacks the most today besides devs are libraries
21:30:04FromGitter<mratsim> we want to make library development smooth
21:30:44FromGitter<arnetheduck> what comes first, devs or libraries? :)
21:30:53FromGitter<mratsim> In my Nim experience, this packaging issue stuck like a sore thumb, even after I understand all the issues behind
21:31:30Araqshashlick: I love your work btw. I hope I said it before. I didn't believe removing the Nim dependency from Nimble would work out.
21:31:45FromGitter<mratsim> But don't worry, you're not alone, @Araq is well aware of my gripe with Generics early symbols resolution and @zah was well aware of my issues with statics
21:32:14Araq:D but I'm not sad about it, sorry
21:32:41AraqI remember the days before we got the generic prepass, it was even more ridiculous
21:33:09FromGitter<mratsim> I mean I even complained to shashlick about wanting to see the proc signature nimgen generated
21:33:39dom96I think things have improved. Nowadays Nimble creates a package structure for you via `nimble init` so there really isn't much room for problems
21:34:08FromGitter<jrfondren> yeah I haven't had any problems probably because I followed that
21:34:23clyybberWith the nocompiler branch merged, is there a flag to specify which nim compiler nimble should use?
21:34:25FromGitter<mratsim> Still, I think we should improve things for v1.
21:34:45Araqdom96: it's time we apply some learned lessons, seriously.
21:34:51FromGitter<jrfondren> actually my main source of friction is "nim c examples/tool_under_construction" and then getting errors and having to "nimble install" and run "nim c" again
21:35:03Araqthere is nothing to be ashamed of.
21:35:04FromGitter<jrfondren> where this is all in the project directory
21:35:11shashlick@Araq - thanks, definitely appreciate it 🙂
21:35:37dom96Araq, like I said, I'm more than happy for improvements. I'm skeptical whether what you are proposing are actual improvements though :P
21:35:55FromGitter<mratsim> yep you definetly deserve the kudos for the past half year @shashlick
21:36:02Araqok, be skeptical, but consider this:
21:36:14dom96Which is why I want one of you to write an RFC outlining what you have in mind
21:36:19shashlick@mratsim - nimgen is close to dead, it has been consumed by nimterop
21:36:38dom96I think a lot of things get lost in IRC
21:36:46Araqhow much of Nimble's design *really* is about being able to write 'import jester' instead of 'import jester / jester' or 'import jester / src / jester'
21:36:48shashlick@clyybber: it just uses the one in path
21:37:08FromGitter<arnetheduck> +1 shashlick :)
21:37:32clyybbershashlick: Ah, I guessed so.
21:37:43AraqIMHO quite of lot of Nimble's design comes down to 'import jester'
21:38:14shashlick@clyybber: but it means you can use the latest nimble with older nim's too which is cool
21:38:24shashlickthanks @arnetheduck 🙂
21:38:30FromGitter<arnetheduck> re nimterop, shashlick, one of the things I'm hitting with `cDebug` and redirecting output is that sometimes during compiles there's other random stuff printed to stdout..
21:38:54Araqand that's a bad reason to butcher the directory structure, sorry.
21:39:08shashlickya i've commented them for now but plan on checking if tty and not print these messages if piped
21:39:20Araqand the code in nimble.nimble that mratsim pointed us to confirms this.
21:39:25shashlickthere's also a request from mratsim to use cDebug to redirect to a file which will be cleaner
21:40:09dom96Araq, that's fine. But I am not convinced that any of the proposals are sufficiently better to warrant changing this
21:40:14FromGitter<arnetheduck> well, if I compile `wrap.nim` in the sqlite repo, it will print `CC: xxx.c` as part of the compile process, and that ends up in my "generated" sqlite.nim.. that's in addition to the random debug output nimterop itself does
21:40:30disrupteki still don't really understand what nimble is for (sorry). i don't use it and don't miss it.
21:40:42*ng0 quit (Quit: Alexa, when is the end of world?)
21:40:55shashlickAraq, dom96 - i'm also worried about backward compatibility - how do we keep both methods alive so that not every package gets broken suddenly
21:40:58dom96Araq, this hack that mratsim points to is something that you really wanted, because you hated duplication of versions so much
21:41:30Araqno, the hack exists because we have two different directory structures at work here
21:41:55Araqbut let's say you are right
21:41:57shashlick@arnetheduck - can you post a gist? not sure
21:42:08Araqand it's my fault for nimble.nimble and has a different reason
21:42:12FromGitter<jrfondren> so what breaks if compiler/modulepaths.nim looks for paths under src/ instead of under /pkgname/ ?
21:42:23Araqit's a pattern I've seen in other .nimble files too
21:42:43clyybbershashlick: Yeah, thats really cool, I guess an option to manually specify the nim path would be also useful, especially when developing using ./koch temp
21:42:55Araqand I've received some RFCs about system.thisPackageDir and stuff like that so that people can write compensation code for this problem
21:43:03FromGitter<mratsim> @arnetheduck @shashlick we talked about that 3 days ago: for now low-priority as we didn't know if it was useful to others but please cast your vote: https://github.com/nimterop/nimterop/issues/127
21:43:50dom96Araq, okay. I go back to challenging you (or someone else) to specify a proposal to improve this
21:43:56shashlick@clyybber: ya that's possible - i need to add support for $CC cause even gcc is hard-coded, can do the same for $NIM as well
21:44:37FromGitter<arnetheduck> shashlick, I hit it the other day just by running update.sh from the sqlite repo, I think with nim 0.19.. but I wasn't thinking about the exact repo then, will let you know later if I find the exact conditions for it to happen
21:44:58dom96It will be nice to yank all this code that checks the package directory structures
21:45:10dom96So please, just write an RFC already :)
21:45:18Araqnow that's the spirit
21:45:30AraqI'm writing...
21:45:38Araqa fresh one?
21:45:38FromGitter<arnetheduck> also, I think the thing is that I don't consider this a "debug" feature - it's an actual useful thing for breaking dependencies, so using `cDebug` for it is a bit confusion :)
21:46:11dom96bbl
21:46:19FromGitter<mratsim> We have a chain of RFC on package structure, this was the last: https://github.com/nim-lang/Nim/issues/7250
21:46:20FromGitter<jrfondren> Nim already has to know to consider this .nimble/pkgs tree. It's not nimble that sets a configuration somewhere to tell Nim to do that. Rather than breaking every existing nimble-installable package and going with crazy talk like "import jester/jester" or "import jester/src/jester", if Nim looks for the src directory, then nimble can check nim's version and have some transition code for the repo structure
21:46:23shashlick@arnetheduck - i just tried it with the latest sqlite wrapper you have and the output is clean
21:46:31FromGitter<mratsim> and previous: https://github.com/nim-lang/Nim/issues/6700
21:46:51FromGitter<jrfondren> that code seems to be in compiler/modulepaths.nim
21:46:54FromGitter<mratsim> each time sparked by IRC discussion and someone summarizing them ;)
21:47:12shashlick@arnetheduck - okay never mind, i see it
21:47:26shashlicki think that's a nim bug, instead of writing to stderr, it is going to stdout
21:47:29FromGitter<jrfondren> result: there's no longer a difference in the installed directory structure, but nothing else needs to change. AFAICT.
21:48:00FromGitter<arnetheduck> shashlick, ok cool. not sure when that happens. another random mistake I did was placing `cPlugin` after `cImport` - took a while to figure out why that didn't work
21:48:11FromGitter<jrfondren> and also the thing mratsim did will *still* break but you'll no longer be able to point at the directory structure as the cause of the breakage.
21:48:35*vivus quit (Remote host closed the connection)
21:48:48FromGitter<mratsim> my git clones passed CI, so I think it wouldn't break
21:48:53FromGitter<arnetheduck> well, or it's a nim bug that all the `[hint]` things go to `stderr` when nim is compiling, depending on what you view as nims responsiblity to print
21:49:11shashlick@arnetheduck - understood - i added a new template to help get started with nimterop wrappers - https://github.com/nimterop/nimterop/blob/master/nimterop/template.nim
21:49:17shashlicki'll add some to the docs
21:49:58shashlick@arnetheduck - it's interesting, CC: stuff doesn't come out when running or piping, only when redirecting to file
21:50:00shashlickmakes no sense
21:50:41Araqjrfondren: I prefer to rethink problems from scratch and then think about backwards compatibility or a migration period
21:50:49FromGitter<arnetheduck> well, cc comes out when wrapper changes and nim has to call the c compiler in addition to itself compiling
21:51:19Araqin my experience backwards compat is rather easy to achieve, most of the time
21:52:11FromGitter<jrfondren> it's more that I don't want to ever type "import jester/jester" or "import jester/src/jester" than that I wouldn't want to update paths
21:52:19shashlickgood point - looks like the CC: filename stuff goes to stdout instead of stderr like everything else
21:53:50FromGitter<jrfondren> meanwhile... `# 2nd attempt: try to use 'karax/karax'`, `# 3rd attempt: try to use 'karax/src/karax'`
21:54:14shashlicklooks like we need an __init__.py deal going now
21:54:17Araqkarax has no 'src'
21:55:01Araq"import jester/jester" is simply honest.
21:55:04FromGitter<jrfondren> well the code's of course `attempt(dir / pkg / f)` and then `attempt(dir / "src" / f)` respectively.
21:55:13FromGitter<jrfondren> and there's `attempt(dir / "src" / pkg / f)`
21:56:33FromGitter<mratsim> Well, like @arnetheduck if we look into package management, I think Rust does it quite right. I have lots of issues with Python package management, and it's telling that they had easy_install, now pip, and that the Anaconda devs are fighting against them because they feel like being stifled when they want to introduce new package management features (I think it was shipping prebuilt binaries better than the wheel .whl
21:56:33FromGitter... system)
21:56:44*JappleAck left #nim (#nim)
21:57:01*solitudesf quit (Ping timeout: 246 seconds)
21:57:34FromGitter<mratsim> but you're basically forced into cargo
22:00:20FromGitter<jrfondren> also everything I was talking about just now's under a `when false:` and I am blind.
22:00:47FromGitter<mratsim> when compiles ;)
22:14:58*vlad1777d_ joined #nim
22:25:34*theelous3_ quit (Ping timeout: 252 seconds)
22:26:35*xet7 quit (Remote host closed the connection)
22:32:13cy1mratsim: I will contest that it's not without problem to have your package system include prebuilt binaries. People trying to write secure software will find those systems to be a minefield of gotchas.
22:32:40cy1but python's package management system isn't all that great, it's true
22:32:52*cyberjpn joined #nim
22:33:56FromDiscord_<!!Liam is Unlucky> This c library uses _Bool but nim doesn't seem to allow types with _ at start anyone know how I can do it
22:33:56FromDiscord_<!!Liam is Unlucky> type _Bool = bool (wont work because of _)
22:34:18FromDiscord_<!!Liam is Unlucky> for some reason the _ doesn appear
22:34:24FromDiscord_<!!Liam is Unlucky> for some reason the _ doesnt appear
22:34:30FromDiscord_<!!Liam is Unlucky> for some reason the _ doesnt appear in discord??
22:34:41FromDiscord_<!!Liam is Unlucky> This c library uses _Bool but nim doesn't seem to allow types with _ at start anyone know how I can do it
22:34:41FromDiscord_<!!Liam is Unlucky> type \_Bool = bool (wont work because of _)
22:34:47FromGitter<jrfondren> it's used for italics
22:35:03FromDiscord_<!!Liam is Unlucky> oh I just added \\ in anyway
22:35:23FromDiscord_<!!Liam is Unlucky> This c library uses _Bool but nim doesn't seem to allow types with \_ at start anyone know how I can do it
22:35:23FromDiscord_<!!Liam is Unlucky> type \_Bool = bool (wont work because of _)
22:35:32FromDiscord_<!!Liam is Unlucky> This c library uses _Bool but nim doesn't seem to allow types with \_ at start anyone know how I can do it
22:35:32FromDiscord_<!!Liam is Unlucky> type \_Bool = bool (wont work because of \_)
22:35:49*cy1 left #nim (#nim)
22:35:51FromGitter<jrfondren> also every time you edit a message in discord it's sent as a new message
22:36:12FromDiscord_<!!Liam is Unlucky> oh, woops
22:36:41FromGitter<jrfondren> anyway you don't need `_Bool` to work in Nim. You just need to give C what values expects for that type--C doesn't care what Nim calls that type of values
22:37:13FromGitter<jrfondren> so I imagine you're doing something more specific that's failing, like nim2c or something? I've only used manual {.cimport.} kind of FFI
22:38:02FromDiscord_<!!Liam is Unlucky> c2nim (nimgen but that just simplifies it)
22:39:00Araqtype CBool {.importc: "_Bool".} = cint or something
22:39:22Araqthe C name is irrelevant, for Nim it's within a string
22:39:30Araqhttps://github.com/nim-lang/nimble/issues/653 here you go, dom96
22:39:42FromDiscord_<!!Liam is Unlucky> thanks
22:39:55clyybberAraq: A global var always has skModule as an owner, is that correct?
22:40:07Araqor the sfGlobal flag
22:40:22Araqor it's a threadvar
22:40:30clyybberah, ok. forgot about the {.global.} pragma
22:40:52Araqdon't worry, we have a review process
22:47:26clyybberi know :D
23:07:33*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:11:21dom96Araq, for simplicity's sake, and to not derail our discussions might be worth removing the clause about `git clone`
23:11:28dom96that's a separate detail that's not relevant IMO
23:11:49AraqI wrote it this way
23:11:59dom96Great write up though, thank you
23:12:01Araqyou can add your remarks
23:12:25shashlickI see you put the src/ idea on there
23:12:43shashlickSo you prefer having a clean repo as well
23:17:34Araqgood night
23:23:44clyybbergood night
23:23:46*clyybber quit (Quit: WeeChat 2.4)
23:34:20*leorize quit (Remote host closed the connection)
23:34:58*leorize joined #nim
23:37:00*jjido joined #nim
23:37:19*kapilp quit (Quit: Connection closed for inactivity)
23:48:53*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:59:59*cyberjpn quit (Ping timeout: 258 seconds)