<< 21-05-2019 >>

00:16:52*Snircle joined #nim
01:19:54*Kaivo quit (Remote host closed the connection)
01:31:23*rockcavera quit (Ping timeout: 246 seconds)
01:34:58*ng0_ joined #nim
01:37:55*ng0 quit (Ping timeout: 256 seconds)
01:38:47*rockcavera joined #nim
01:44:38*rnrwashere joined #nim
01:52:55*smitop quit (Quit: Connection closed for inactivity)
02:01:37*banc quit (Quit: Bye)
02:07:03FromDiscord<DeltaPHC> Is a normal `object` copied around by default? I know `ref object` is as the name implies and is traced by the GC
02:11:25*rnrwashe_ joined #nim
02:15:03*rnrwashere quit (Ping timeout: 264 seconds)
02:20:39*banc joined #nim
02:24:15*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
02:26:38leorizeDeltaPHC: yea, although it depends
02:26:53leorizethe compiler supports move optimization, which will be used whenever possible
02:30:58*dddddd quit (Remote host closed the connection)
02:31:17leorizepoopBot: use the matrix client for weechat
02:31:44leorizesurprisingly, it's supports more feature than most GUI clients
02:33:59FromGitter<kaushalmodi> I am facing an unexpected error here: ⏎ ⏎ ```import strutils ⏎ echo toLowerAscii("ABC").removeSuffix("c")``` ⏎ ⏎ I looked at the signature of `toLowerAscii`, but it's not clear why it cannot be chained like this [https://gitter.im/nim-lang/Nim?at=5ce363960ec37966a1a578d4]
02:36:58FromGitter<kaushalmodi> oh nevermind, I was starring at the wrong proc signature
02:37:15FromGitter<kaushalmodi> I needed to focus on removeSuffix
03:01:27skrylar[m]something about doing string comparisons in event systems jitters my ocd
03:04:49skrylar[m]python and urho do this and i guess its fine, but it seems really :| to do linear scans on message buffers and then strcmps to see which one is "mousebutton"
03:25:56*theelous3 quit (Ping timeout: 268 seconds)
04:09:49*rnrwashe_ quit (Remote host closed the connection)
04:24:09*nsf joined #nim
04:33:15FromGitter<kaushalmodi> Just wanted to say that Source Code Filters are awesome!
04:38:20FromGitter<jrfondren> where are you using them? I've seen one for generating templates and a cheeky give-me-my-hard-tabs use
04:58:52leorizenimforum have one for rss too: https://github.com/nim-lang/nimforum/blob/master/src/main.tmpl
05:06:09*rnrwashere joined #nim
05:10:17*rnrwashere quit (Ping timeout: 250 seconds)
05:20:26*leorize quit (Quit: WeeChat 2.3)
05:20:56*Jesin quit (Ping timeout: 258 seconds)
05:25:22*Jesin joined #nim
05:30:13*rockcavera quit (Ping timeout: 246 seconds)
05:38:59*solitudesf joined #nim
05:48:22*kapilp joined #nim
05:48:24*leorize joined #nim
05:51:09*rockcavera joined #nim
06:13:10*narimiran joined #nim
06:17:34narimiran@kiwi @jrfondren @xace you can do: `import sequtils; let a = toSeq(1..100)`
06:19:06leorizethere's also newSeqWith
06:19:17leorizenever used it though
06:36:20*PMunch joined #nim
06:39:39PMunchAnyone knows how to solve this in c2nim? Is it a bug? When a struct is typedefed in C one can still use the old struct name, albeit with a struct prefix http://ix.io/1JDd
06:48:35PMunchApparently this is already a known issue: https://github.com/nim-lang/c2nim/issues/62
06:52:37*solitudesf quit (Ping timeout: 259 seconds)
07:00:00*gmpreussner quit (Quit: kthxbye)
07:04:32*gmpreussner joined #nim
07:12:36PMunchHmm, looking at fixing it now. Should the symbol be exported or not?
07:14:09leorizethe `ptr` part is a bug
07:17:05*rokups joined #nim
07:24:13*krux02 joined #nim
07:25:06*Vladar joined #nim
07:47:03PMunchIs it?
07:47:08PMunchHow so?
07:47:33PMunchI guess the better Nim way would be to declare it a ref object
07:47:38leorizethe type name doesn't match :p
08:11:31*floppydh joined #nim
08:13:50*neceve joined #nim
08:14:39*Vladar quit (Remote host closed the connection)
09:01:16PMunchleorize, what do you mean?
09:02:14leorizethe type name in the `ptr` part is not capitalized
09:04:19*tdc quit (Quit: Leaving)
09:11:37PMunchOh yeah, I know, but the issue is actually deeper than that
09:11:47PMunchThe two names could be completely different
09:32:51*couven92 joined #nim
09:37:00*clyybber joined #nim
09:39:27*Vladar joined #nim
10:01:17*lritter joined #nim
10:07:23*leorize quit (Quit: WeeChat 2.3)
10:17:36*jjido joined #nim
10:18:34xaceOh I see. I had a strong hunch I should've checked out sequtils
10:25:16*Jesin quit (Ping timeout: 246 seconds)
10:27:18FromGitter<kaushalmodi> @jrfondren I'm using one to generate a file with boilerplate code at work
10:28:41FromGitter<kaushalmodi> User specifes the subdir location, class, base class names, and then little helpers like allowing overwrites, auto-opening the generated file in EDITOR, etc
10:35:53FromGitter<kaushalmodi> @jrfondren Also, I have once used Source Code Filters in the past to generate an HTML page (with a huge html table) from an input JSON (which I created by parsing multiple html pages). That was a fun little project too.
11:13:43*livcd quit (Changing host)
11:13:43*livcd joined #nim
11:16:36*abm joined #nim
11:40:19*elrood joined #nim
11:48:12*jeyr joined #nim
11:51:43*jeyr quit (Client Quit)
12:04:52*seni joined #nim
12:11:42*dddddd joined #nim
12:14:25skrylar[m]so as i understand it, the current idiomatic way to implement Flattenable in nim is via generics+a concept? (https://www.haiku-os.org/legacy-docs/bebook/BFlattenable.html)
12:17:07skrylar[m]thats how i was doing it with flatbuffers so i guess thats how we're still doing it
12:30:54*Vladar quit (Remote host closed the connection)
12:31:51*Kaivo joined #nim
12:35:55krux02skrylar[m], sorry I am a bit out of context, what is Flatten supposed to do?
12:45:01*Snircle joined #nim
12:46:25FromGitter<kaushalmodi> TIL that nim accepted code from stdin and that apparently broke in a regression in v0.19.0. Ref: https://github.com/JRaspass/code-golf/issues/86#issuecomment-494374484
12:47:03FromGitter<kaushalmodi> this came up in a discussion on supporting Nim on the Codegolf.io site
12:47:15FromGitter<kaushalmodi> anybody can help with Nim stdin support over there?
12:48:08*Vladar joined #nim
12:50:26ZevvI might, but unix only
12:52:35skrylar[m]krux02: low level serialization
12:55:05skrylar[m]flatten seems to just say the object can be dumped to binary and loaded again, the object gets to decide the 'how'
13:02:07krux02skrylar[m], well I have written something like that in the past already
13:04:04*solitudesf joined #nim
13:04:35krux02in nim concepts are experimental, so I don't recommend to use that language feature, but conceptially you are right
13:04:49*ng0_ quit (Remote host closed the connection)
13:05:05krux02for strformat I introduced overloats of ``formatValue`` for all types that should be usable in ``strformat``.
13:05:27krux02so you can do the same thing with overloads off ``sorializeValue``
13:06:35krux02and then every type that provides an overload of ``serializeValue``, or is coposed that support the ``serializeValue`` operation can be serialized
13:08:28skrylar[m]decanting is going to be bumpy
13:08:48skrylar[m]i guess that works by registering a closure that knows how to call the decanting generic in a map
13:21:20*abm quit (Quit: Leaving)
13:23:33*ShalokShalom quit (Ping timeout: 244 seconds)
13:28:07skrylar[m]krux02: https://pastebin.com/7HYp9WtQ seems a little clunky but i guess it works fine
13:30:08krux02I remember I wrote a serialization like that before
13:31:24krux02I wrote two serialization procs, one that didn't write anything but measured just the size so that it can be allocated in the exact length when the true serialization takes place.
13:52:39krux02skrylar[m], I found my old serialization code, this is the full file and not everything is related to serialization but it works very well: http://ix.io/1JEu/nim
13:54:11krux02skrylar[m], it starts at line 140
13:55:11krux02but I see, it does not work for reference types with cycles
13:57:39*poopBot1 joined #nim
13:57:46*solitudesf- joined #nim
13:58:25*nif_ joined #nim
13:58:47*redlegion_ joined #nim
13:59:05*FromDiscord_ joined #nim
14:01:13*Zevv_ joined #nim
14:01:21*clyybber1 joined #nim
14:01:26*WilhelmV1nWeiner joined #nim
14:01:41*matti_ joined #nim
14:01:44*jxy_ joined #nim
14:02:05*acidx_ joined #nim
14:02:09*Senketsu joined #nim
14:03:20*PMunch quit (Remote host closed the connection)
14:04:33*def-- joined #nim
14:04:52*Lord_Nightmare2 joined #nim
14:04:54*Cthalupa- joined #nim
14:05:48*dom96_ joined #nim
14:06:10*clyybber quit (*.net *.split)
14:06:14*vlad1777d quit (*.net *.split)
14:06:14*Zevv quit (*.net *.split)
14:06:15*Lord_Nightmare quit (*.net *.split)
14:06:17*Jjp137 quit (*.net *.split)
14:06:17*Cthalupa quit (*.net *.split)
14:06:19*nif quit (*.net *.split)
14:06:20*FromGitter quit (*.net *.split)
14:06:20*jxy quit (*.net *.split)
14:06:29*def- quit (*.net *.split)
14:06:31*WilhelmVonWeiner quit (*.net *.split)
14:06:32*go|dfish quit (*.net *.split)
14:06:33*redlegion quit (*.net *.split)
14:06:33*matti quit (*.net *.split)
14:06:40*Lord_Nightmare2 is now known as Lord_Nightmare
14:06:41*def-- is now known as def-
14:06:42*FromGitter joined #nim
14:06:43*solitudesf quit (*.net *.split)
14:06:44*lritter quit (*.net *.split)
14:06:48*poopBot quit (*.net *.split)
14:06:55*Tanger quit (*.net *.split)
14:07:01*FromDiscord quit (*.net *.split)
14:07:04*Sencatsu quit (*.net *.split)
14:07:06*dom96 quit (*.net *.split)
14:07:08*acidx quit (*.net *.split)
14:07:16*so quit (*.net *.split)
14:11:21*stefanos82 joined #nim
14:12:12*kapilp quit (Quit: Connection closed for inactivity)
14:12:39*vlad1777d joined #nim
14:12:59*go|dfish joined #nim
14:13:16*Tanger joined #nim
14:13:57*Jjp137 joined #nim
14:17:07*lritter joined #nim
14:25:35*Zevv_ is now known as Zevv
14:26:13*leorize joined #nim
14:28:22*Zevv left #nim (#nim)
14:28:25*Zevv joined #nim
14:41:50*nsf quit (Quit: WeeChat 2.4)
14:47:59*solitudesf- quit (Quit: Leaving)
14:48:19*solitudesf joined #nim
15:02:32*solitudesf quit (Remote host closed the connection)
15:02:37*solitudesf- joined #nim
15:14:47*theelous3 joined #nim
15:21:15*rnrwashere joined #nim
15:30:06*Trustable joined #nim
15:38:38*salewski joined #nim
15:39:59salewskiCan we select a random entry from a table? (like sample(mySeq) for sequences)
15:40:07*kapilp joined #nim
15:40:57FromGitter<jrfondren> you need a separate array of the table's keys.
15:42:09FromGitter<jrfondren> hash tables use a sparse array, and might also have lists to avoid collision (I don't know what Nim's tables use), so there's no efficient way to randomly select a key without something like a separate array of just the keys.
15:43:02FromGitter<jrfondren> ah IIRC Nim's tables are backed by a seq[T], so they probably use open addressing, not lists. same problem though.
15:44:22leorizean inefficient way:
15:45:05leorizelet k = toSeq(keys(table))
15:45:17leorizeecho table[sample k]
15:46:20FromGitter<jrfondren> that plus keeping k around is basically the efficient way.
15:47:13salewskiNo, I need a very efficient way :-) Table stores vertices of a 2D triangulation, and I have to select start values for jump and walk algorithm.
15:47:22FromGitter<jrfondren> since Nim is using open addressing, an alternative's to randomly index into the backing array and then step forward until you find an entry. that'll be distorted but it might be random enough.
15:47:41Araqfor speed don't use tables
15:47:59salewskiI think it should be possible, as table uses seq, and seq if filled dense, so a few random lookups would do
15:48:08salewskiBut seems it is not available.
15:49:26salewskiYes, I do considerb not to use tables indeed, but I have to add and delete vertices, so table would be one way to store elements.
15:49:38salewskiSorted Array may be other method.
15:49:59salewskiMabe I should use a tree.
15:51:06salewskiVertices have consecutive keys, but we can delete Vertices, so we get holes.
15:52:15salewskiI have seem implementations which just mark deletet elements as deleted, and try to reuses places. But all that is not really efficient.
15:53:38FromGitter<jrfondren> give leorize's method a try.
15:54:10salewskiMy latest idea was to store vertices in a seq, and use a hash table to map IDs to position.
15:54:46salewskitoSeq(table) must be slow?
15:56:10FromGitter<jrfondren> are you going to update the keys between random lookups?
15:57:40salewskiYes, it is a fully dynamic constrained delaunay triangulation, so insert/remove vertices interleaves.
15:58:33salewskiOK, I will do some testing. Code will be shipped to github in a few days, I will ask again then. By.
16:00:02*salewski quit (Quit: WeeChat 2.3)
16:00:37*floppydh quit (Quit: WeeChat 2.4)
16:05:33*NimBot joined #nim
16:30:45*WilhelmV1nWeiner quit (Quit: leaving)
16:31:03*WilhelmVonWeiner joined #nim
16:41:13*so joined #nim
16:42:33FromGitter<kinkinkijkin> alright i need to figure out how to implement this line of dependence in my program
17:01:00FromGitter<kinkinkijkin> might be difficult with how i wrote the parser
17:06:46*rokups quit (Quit: Connection closed for inactivity)
17:11:36*rnrwashere quit (Remote host closed the connection)
17:19:06*rnrwashere joined #nim
17:20:27*solitudesf- quit (Quit: Leaving)
17:20:47*solitudesf joined #nim
17:26:08*neceve quit (Remote host closed the connection)
17:32:21Zevvdid I hear someone say "parser"!
17:32:37FromGitter<kinkinkijkin> yes
17:33:16Zevvnah, nevermind me, just trolling, sorry
17:47:45*rnrwashere quit (Remote host closed the connection)
17:48:39*rnrwashere joined #nim
17:52:11*natrys joined #nim
17:54:10*Trustable quit (Remote host closed the connection)
18:10:22FromGitter<liquid600pgm> I have to check out NPeg, btw
18:10:40FromGitter<liquid600pgm> maybe I'll use it in rod to save some time writing a parser manually
18:28:41*nsf joined #nim
18:28:42*jjido_ joined #nim
18:28:42*jjido quit ()
18:30:41*elrood quit (Remote host closed the connection)
18:30:54*forkbomb9[m] left #nim ("User left")
18:34:18*jjido_ is now known as jjido
18:36:08*natrys quit (Remote host closed the connection)
18:36:40*natrys joined #nim
19:15:35*rnrwashere quit (Remote host closed the connection)
19:17:15*rnrwashere joined #nim
19:24:14*rnrwashe_ joined #nim
19:27:38*rnrwashere quit (Ping timeout: 252 seconds)
19:31:40*PrimHelios quit (Ping timeout: 252 seconds)
19:32:20*PrimHelios joined #nim
19:36:07*ng0 joined #nim
19:39:26*solitudesf- joined #nim
19:40:46*rnrwashere joined #nim
19:41:34*solitudesf quit (Ping timeout: 252 seconds)
19:43:27*rnrwashe_ quit (Ping timeout: 250 seconds)
19:44:51*rnrwashere quit (Remote host closed the connection)
19:47:16FromGitter<Varriount> npeg?
19:50:13Zevvvarriount: https://github.com/zevv/npeg (shameless self-promotion)
19:50:54*rnrwashere joined #nim
19:52:08*solitudesf- quit (Quit: Leaving)
19:52:24*solitudesf joined #nim
19:58:04*narimiran quit (Ping timeout: 258 seconds)
20:01:37WilhelmVonWeinerhow would I write a macro that creates an alias for a given item in an object or tuple?
20:02:04WilhelmVonWeinerfor example, I could write `template i: untyped = obj.index`
20:02:37WilhelmVonWeinerbut say I wanted to do that for n different fields in multiple procs
20:03:21Araqgood question, unfortunately I'm too tired to answer it
20:03:50WilhelmVonWeinerlol.
20:04:48WilhelmVonWeinerI've been trying to "return quote do: template x: untyped = `obj.x` " and a lot of stuff like that
20:10:04*nsf quit (Quit: WeeChat 2.4)
20:11:19WilhelmVonWeinervarious approaches like thus https://hastebin.com/afihuqemaj.sql
20:12:12*kapilp quit (Quit: Connection closed for inactivity)
20:12:25FromGitter<jrfondren> use the Pascal `with` for that: https://github.com/zevv/with
20:12:59FromGitter<jrfondren> I thought you were looking for the Python `with` until you provided that paste. completely different thing.
20:17:37WilhelmVonWeinerthat's so crazy
20:17:38WilhelmVonWeinercool
20:17:55*rnrwashere quit (Remote host closed the connection)
20:24:11Zevvgrxnola
20:24:17WilhelmVonWeinerayy
20:24:38Zevv:)
20:28:45*Vladar quit (Remote host closed the connection)
20:35:09*natrys quit (Quit: natrys)
20:38:43*Jesin joined #nim
20:42:03*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:49:02*lritter quit (Ping timeout: 252 seconds)
21:00:56*cybj quit (Ping timeout: 258 seconds)
21:02:21*cybj joined #nim
21:03:14*rnrwashere joined #nim
21:05:29*rnrwashe_ joined #nim
21:06:03*rnrwashe_ quit (Remote host closed the connection)
21:06:09*rnrwashe_ joined #nim
21:06:10*rnrwashere quit (Read error: Connection reset by peer)
21:10:26*rnrwashe_ quit (Remote host closed the connection)
21:11:25*rnrwashere joined #nim
21:13:45*rnrwashere quit (Read error: Connection reset by peer)
21:19:43*rnrwashere joined #nim
21:21:07*ng0 quit (Ping timeout: 256 seconds)
21:22:49*leorize quit (Ping timeout: 256 seconds)
21:23:22*ng0 joined #nim
21:24:04*rnrwashere quit (Remote host closed the connection)
21:24:18*leorize joined #nim
21:25:27*rnrwashere joined #nim
21:26:44*rnrwashere quit (Remote host closed the connection)
21:26:55*rnrwashere joined #nim
21:29:02*rnrwashere quit (Remote host closed the connection)
21:29:13*jjido joined #nim
21:32:37*rnrwashere joined #nim
21:34:24*smitop joined #nim
21:34:29*rnrwashe_ joined #nim
21:34:34smitopWhy doesn't this code work?
21:34:37smitop`proc newWebSocket(uri: string, protocols = []) {.importcpp: "new WebSocket(#, #)"}`
21:34:46smitopgenerates
21:35:22smitophttps://pastebin.com/raw/unjGkgeT
21:36:17FromGitter<jrfondren> looks like a codegen bug. there might already be something for it. but, what type do you expect Nim to take protocols for?
21:37:14smitopI'm trying to wrap the JS websockets API, and it has an optional array of strings as a parameter: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket
21:37:17*rnrwashere quit (Ping timeout: 258 seconds)
21:37:34FromGitter<jrfondren> how is Nim going to know that it's an array of strings though?
21:38:18smitopHow do I specify that? doesn't Nim auto-infer types on params with default values?
21:38:39*rnrwashe_ quit (Ping timeout: 248 seconds)
21:39:11FromGitter<jrfondren> sure it infers them, but an empty array tells you nothing about what that array can hold
21:39:44smitop`proc newWebSocket(uri: string, protocols: seq[string] = @[]) {.importcpp: "new WebSocket(#, #)"}`
21:39:47smitopgives the same error
21:41:30smitopOh the problem was that I was compiling it as C not JS
21:41:41smitopbut the compiler should still give better error messages
21:54:29smitopDoes `{.noSideEffects.}` imply `{.effects: [], throws: []}`?
21:57:01FromGitter<jrfondren> looks like it doesn't.
21:57:48FromGitter<jrfondren> `{.noSideEffect.}` and `raises:`. I don't know what `effects: []` is.
21:58:15FromGitter<jrfondren> but you can define a `{.noSideEffect.}` proc that throws.
22:11:20Araqthere is a precise definition about what .noSideEffect means
22:15:06Araqcontrol flow is not an effect.
22:16:18*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:33:13*arecaceae quit (Remote host closed the connection)
22:33:32*arecaceae joined #nim
22:47:53*solitudesf quit (Ping timeout: 258 seconds)
22:59:28*krux02 quit (Remote host closed the connection)
23:01:01FromDiscord_<treeform> smitop, I use this for jswebsocket https://github.com/stisa/jswebsockets
23:01:27FromDiscord_<treeform> I eventually want to make https://github.com/treeform/ws support js too with similar API.
23:01:42FromDiscord_<treeform> annoying thing is that js api is call back based, but nim like async based more
23:05:20*stefanos82 quit (Remote host closed the connection)
23:05:59*rnrwashere joined #nim
23:10:35*rnrwashere quit (Ping timeout: 250 seconds)
23:23:12*Kaivo quit (Quit: WeeChat 2.4)
23:44:11*rockcavera quit (Remote host closed the connection)
23:57:15*ng0 quit (Quit: Alexa, when is the end of world?)