00:04:29 | * | leorize joined #nim |
00:05:12 | * | dillonb quit (Quit: WeeChat 2.2) |
00:05:51 | * | loading joined #nim |
00:05:53 | loading | hi |
00:05:59 | disruptek | hello |
00:06:06 | loading | hows life |
00:06:43 | disruptek | fair to middling. |
00:06:46 | disruptek | you? |
00:07:22 | clyybber | still loading |
00:07:59 | clyybber | sup loading |
00:08:19 | clyybber | gn8 ppl |
00:08:21 | * | clyybber quit (Quit: WeeChat 2.7) |
00:09:47 | * | gmpreussner quit (Quit: kthxbye) |
00:10:55 | loading | hi |
00:12:48 | * | gmpreussner joined #nim |
00:20:12 | * | krux02 quit (Remote host closed the connection) |
00:26:50 | shashlick | yay choosenim 0.5.0 is finally out - https://github.com/dom96/choosenim/releases/tag/v0.5.0 |
00:27:59 | * | gmpreussner_ joined #nim |
00:29:12 | * | gmpreussner quit (Ping timeout: 260 seconds) |
00:32:04 | * | loading quit (Remote host closed the connection) |
00:43:20 | * | voltist joined #nim |
01:11:03 | * | setenforce joined #nim |
01:12:26 | * | zedeus joined #nim |
01:26:59 | * | russellb joined #nim |
01:27:49 | russellb | folks |
01:27:59 | russellb | nim beginner |
01:28:15 | russellb | any sources and example projects to learn nim is much appreciated |
01:28:25 | * | icebattle quit (Ping timeout: 258 seconds) |
01:29:54 | * | icebattle joined #nim |
01:30:16 | disruptek | russellb: what kinda projects are you looking to author? |
01:34:19 | russellb | physics simulations |
01:34:30 | russellb | numerical computations |
01:34:37 | russellb | @distruptek |
01:35:10 | disruptek | scientific computing is mratsim's department. |
01:35:30 | disruptek | !repo arraymancer |
01:35:32 | disbot | https://github.com/mratsim/Arraymancer -- 9Arraymancer: 11A fast, ergonomic and portable tensor library in Nim with a deep learning focus for CPU, GPU and embedded devices via OpenMP, Cuda and OpenCL backends 15 533โญ 48๐ด 7& 6 more... |
01:36:02 | disruptek | !repo weave |
01:36:03 | disbot | https://github.com/mratsim/weave -- 9weave: 11A state-of-the-art multithreading runtime: message-passing based, fast, scalable, ultra-low overhead 15 70โญ 6๐ด |
01:36:35 | disruptek | i'm a guy that writes the dogshit that smart folks are too busy to bother with. |
01:37:18 | russellb | I am coming from rust |
01:37:52 | russellb | I find nim libraries documentation is not elaborate in comparison to rust. |
01:38:01 | russellb | i m firm on nim though. |
01:38:14 | russellb | excellent combo of syntactic ease and compiled power |
01:38:46 | russellb | libraries are good start from first impression |
01:38:50 | disruptek | yeah, the tech is there, it's just early days for the community. |
01:39:03 | * | voltist quit (Quit: Quit) |
01:40:49 | russellb | however, I find lot of similarities conceptually b/w rust and nim |
01:40:59 | russellb | except borrow checker and gc |
01:41:04 | russellb | bc & gc |
01:41:11 | russellb | ;-P |
01:41:20 | russellb | algebraic data types |
01:41:40 | leorize | well, languages designed to make programming safer will always be kinda the same :P |
01:41:58 | russellb | typedefs and methods (in nim lingo - procs) |
01:42:31 | * | voltist joined #nim |
01:43:27 | russellb | @leorize: rust has all the mines burried under the hood with walk paths paved off from them |
01:44:00 | russellb | lot of unsafe code in the std library |
01:44:18 | leorize | that's the same everywhere :P |
01:44:26 | russellb | just not allowing hte novice user to make some memory error |
01:44:35 | leorize | just that we don't label code paths in Nim as "unsafe" |
01:44:37 | russellb | but ofrces to think ahead of typing |
01:44:47 | leorize | if you see cast, addr, and ptr, then it's unsafe |
01:45:00 | russellb | but others doesn't claim to be memory safe as rust does |
01:45:44 | russellb | ptr are inherently unsafe? is it? |
01:46:06 | leorize | yep, due to the fact that they are not managed |
01:46:14 | leorize | ref on the other hand is totally safe |
01:46:21 | disruptek | it's a feature. |
01:48:56 | russellb | any overhead on "ref"? |
01:49:02 | leorize | russellb: of course as with all "unsafe" feature, you can write abstractions on top of them that make them safe :) |
01:49:15 | leorize | other than the gc, no |
01:50:00 | leorize | and we are experimenting with different models that eliminate the full-fledged GC we have |
01:50:31 | russellb | well I need to study nim's GC mech yet. |
01:51:02 | russellb | any novel ideas in it, so far? |
01:51:15 | * | voltist_ joined #nim |
01:51:43 | disruptek | i mean, yeah. |
01:52:13 | leorize | https://github.com/nim-lang/RFCs/issues/144 |
01:52:15 | disbot | โฅ Proposal to add 'owned' refs to Nim ; snippet at 12https://play.nim-lang.org/#ix=24U9 |
01:52:18 | leorize | https://github.com/nim-lang/RFCs/issues/177 |
01:52:22 | disbot | โฅ Unify Nim's GC/memory management options ; snippet at 12https://play.nim-lang.org/#ix=24Ua |
01:52:23 | * | voltist_ quit (Read error: Connection reset by peer) |
01:52:45 | * | voltist_ joined #nim |
01:53:06 | * | voltist_ quit (Client Quit) |
01:53:55 | * | voltist quit (Read error: Connection reset by peer) |
01:57:23 | russellb | owned 'ref's would be great |
02:02:26 | leorize[m] | it'll be a long road there |
02:02:40 | leorize[m] | the majority of written nim code is incompatible with it |
02:03:31 | leorize[m] | with that said, the current system still works pretty well as long as you do things single threaded |
02:04:12 | leorize[m] | or if you multi thread without sharing data |
02:04:38 | * | watzon joined #nim |
02:06:00 | russellb | multi threading would be great in this era of multi-core processors |
02:06:23 | russellb | But for an evolving stage it should be O.K. |
02:06:57 | russellb | How do you people forsee the nim's position in next 3-5 years? |
02:07:18 | russellb | Is it being used in production somewhere? |
02:07:35 | disruptek | production? sure. |
02:07:46 | leorize[m] | !repo nimbus |
02:07:47 | disbot | https://github.com/status-im/nimbus -- 9nimbus: 11Nimbus: an Ethereum 1.0 & 2.0 Client for Resource-Restricted Devices 15 311โญ 41๐ด 7& 7 more... |
02:08:34 | leorize[m] | !repo reelvalley |
02:08:34 | disbot | no results ๐ข |
02:09:59 | leorize[m] | !repo nimforum |
02:10:00 | disbot | https://github.com/nim-lang/nimforum -- 9nimforum: 11Lightweight alternative to Discourse written in Nim 15 438โญ 35๐ด 7& 1 more... |
02:10:29 | watzon | I'm fairly certain every semi-popular language is being used in production somewhere. I just got done working for a company that was using Crystal in production |
02:11:00 | russellb | Crystal in production? |
02:11:08 | russellb | That's interesting |
02:11:21 | watzon | Yep. NeuraLegion uses Crystal for pretty much their whole stack |
02:11:26 | russellb | nimbus sounds like a serious project |
02:11:59 | russellb | watzon: that's interesting and inspiring to hear |
02:14:49 | watzon | I'd say there's definitely hope for Nim in that area. It's a great language, and a lot of people love the Pythonic syntax. |
02:14:56 | watzon | Not to mention it's fast |
02:15:47 | disruptek | more go than go. |
02:16:00 | disruptek | and less google. |
02:17:17 | disruptek | this is pretty exciting: |
02:17:19 | disruptek | !repo nlvm |
02:17:20 | disbot | https://github.com/arnetheduck/nlvm -- 9nlvm: 11LLVM-based compiler for the Nim language 15 245โญ 18๐ด 7& 1 more... |
02:20:57 | russellb | that's nice. |
02:21:04 | russellb | disruptek: Have you tried this? |
02:21:30 | disruptek | yeah, but i need to follow devel/1.0 for now. |
02:22:00 | disruptek | i'm hoping to run nim/nlvm in graalvm. |
02:23:41 | russellb | o.k |
02:24:05 | russellb | post your experiences, best through a blog |
02:25:02 | disruptek | i don't really understand blogs. |
02:25:10 | disruptek | who has time to search out content like that? |
02:25:37 | disruptek | i'd rather write code. but, i'm old. |
02:25:45 | disruptek | only a few more years left, if i'm lucky. |
02:26:35 | russellb | !! |
02:27:31 | disruptek | i'm working on this: |
02:27:33 | disruptek | !repo nimph |
02:27:34 | disbot | https://github.com/disruptek/nimph -- 9nimph: 11a nim package hierarchy manager from the future ๐ง 15 22โญ 1๐ด 7& 1 more... |
02:28:57 | russellb | lemme check this out |
03:12:56 | * | icebattle quit (Ping timeout: 268 seconds) |
03:14:19 | FromGitter | <iffy> Since I didn't find a library for this already: https://github.com/iffy/nim-keyring I'll work on Linux when I next get a chance |
03:33:28 | * | endragor quit (Remote host closed the connection) |
03:35:04 | * | endragor joined #nim |
03:39:54 | * | endragor quit (Ping timeout: 258 seconds) |
03:43:16 | * | russellb left #nim ("WeeChat 2.7") |
03:56:42 | * | kevinchau joined #nim |
03:59:03 | * | kevinchau quit (Client Quit) |
04:11:55 | * | voltist joined #nim |
04:14:39 | voltist | I find it very hard to believe that nothing has been said on this channel while I have been away. Something must be wrong with my ZNC server... |
04:23:48 | * | chemist69 quit (Ping timeout: 252 seconds) |
04:25:56 | * | chemist69 joined #nim |
04:26:28 | shashlick | its been quiet for the last hour at best |
04:28:55 | * | endragor joined #nim |
04:37:31 | * | nsf joined #nim |
05:06:39 | * | oculux quit (Ping timeout: 246 seconds) |
05:07:21 | * | oculux joined #nim |
05:23:32 | disruptek | $ nimph downgrade sdl2_nim |
05:23:37 | disruptek | rolled sdl2_nim from 2.0.10 to v0.95 |
05:23:50 | disruptek | i swear this person hates me. |
05:24:26 | disruptek | rolled sdl2_nim from 0.95.0 to v2.0.10.0 |
05:24:35 | disruptek | it's madness, is what it is. sheer madness. |
05:27:18 | shashlick | someone's got to disrupt you too buddy |
05:41:25 | * | voltist quit (Quit: Leaving) |
05:51:27 | FromGitter | <zacharycarter> (https://files.gitter.im/nim-lang/Nim/nrIm/image.png) |
05:51:33 | FromGitter | <zacharycarter> starting to look pretty good I think |
05:52:10 | FromGitter | <zacharycarter> it doesn't look as tiled anymore |
05:59:05 | FromGitter | <juancarlospaco> New choosenim is not updating?. Info: Already up to date at version 0.4.0 |
06:01:28 | * | marmotini_ joined #nim |
06:06:23 | shashlick | looks like it is not updated on http://nim-lang.org website, need to ping dom96 |
06:07:13 | watzon | Hmm mine says version 0.5.0 |
06:08:27 | shashlick | https://nim-lang.org/choosenim/stable still shows 0.4.0 |
06:09:04 | shashlick | also unclear where it downloads the binaries from |
06:09:21 | shashlick | when you update or run the init.sh script |
06:14:50 | * | marmotini_ quit (Ping timeout: 265 seconds) |
06:19:11 | * | gour joined #nim |
06:29:06 | * | actuallybatman quit (Quit: leaving) |
06:39:42 | * | voltist joined #nim |
06:40:04 | * | voltist quit (Client Quit) |
06:40:29 | * | solitudesf joined #nim |
06:44:00 | * | sealmove quit (Quit: WeeChat 2.6) |
06:44:53 | * | disbot quit (Ping timeout: 245 seconds) |
06:45:17 | * | disruptek quit (Ping timeout: 265 seconds) |
06:46:19 | * | marmotini_ joined #nim |
06:46:41 | * | marmotini_ quit (Remote host closed the connection) |
06:46:57 | * | marmotini_ joined #nim |
06:51:40 | * | marmotin_ joined #nim |
06:52:26 | * | marmotini_ quit (Ping timeout: 240 seconds) |
06:53:42 | * | dddddd quit (Ping timeout: 268 seconds) |
07:00:31 | * | narimiran joined #nim |
07:08:53 | * | disbot joined #nim |
07:09:23 | * | disruptek joined #nim |
07:21:00 | * | marmotin_ quit (Read error: No route to host) |
07:21:11 | * | marmotini_ joined #nim |
07:28:04 | * | PMunch joined #nim |
08:00:00 | * | gmpreussner_ quit (Quit: kthxbye) |
08:04:49 | * | gmpreussner joined #nim |
08:16:55 | * | Zevv quit (Ping timeout: 265 seconds) |
08:37:36 | Araq | ping mratsim |
08:38:27 | * | Zevv joined #nim |
08:38:45 | Araq | interesting how things are done in Swift land, https://gist.github.com/lattner/429b9070918248274f25b714dcfc7619 |
08:40:28 | Araq | they did without the Future abstraction |
08:41:14 | Araq | not sure if it's a big difference in practice, the closures still need to allocate anyway |
08:41:50 | FromDiscord | <Milerius> Hey i'm learning threads with nim i have a question about threadpool |
08:42:15 | FromDiscord | <Milerius> I have a variable that is global inside of my package, but i know this variable will be thread safe, how can i specify it ? |
08:42:42 | FromDiscord | <Milerius> (i get a Error: 'mm2_init_thread' is not GC-safe as it accesses 'mm2_instance' which is a global using GC'ed memory) |
08:43:12 | Araq | it never is threadsafe IME |
08:43:22 | Araq | when the compiler tells you that it isn't |
08:43:48 | Araq | can't outsmart the system. well, you can easily do |
08:43:54 | Araq | {.gcsafe.}: |
08:44:06 | Araq | use global here # I know what I'm doing |
08:44:15 | FromDiscord | <Milerius> Yeah i tried that |
08:44:59 | FromDiscord | <Milerius> Ah nice that compile now |
08:45:00 | FromDiscord | <Milerius> thanks ! |
08:45:14 | Araq | but keep in mind that it's unsafe, the memory backing up refs/strings/seqs is thread-local and "it's immutable" doesn't count either as the GC introduces write barriers |
08:45:20 | Araq | which are not threadsafe either |
08:45:24 | FromDiscord | <Milerius> It's because this variable is accessed once at the beginning of my program |
08:45:28 | FromDiscord | <Milerius> and once at the end of my program |
08:45:34 | FromDiscord | <Milerius> (It's an osproc.Process) |
08:45:44 | FromDiscord | <Milerius> I want to create the process in an async way |
08:45:50 | FromDiscord | <Milerius> And close it at the end of the program |
08:46:28 | FromDiscord | <Milerius> So far i got: https://gist.github.com/Milerius/4dbdad26e6021b3b6a0074225e110607 |
08:46:33 | FromDiscord | <Milerius> Not sure it's the good way to do that |
08:47:58 | FromDiscord | <Milerius> I think Since i access this variable only Twice in the program it's "safe" |
08:48:02 | FromDiscord | <Milerius> Not sure too. |
08:49:03 | FromDiscord | <Milerius> i use it in the main like: initProcess() |
08:49:03 | FromDiscord | <Milerius> and then: defer closeProcess() |
08:52:37 | Araq | sounds ok to me too |
08:52:49 | Araq | there is also an async osproc package somewhere |
08:53:46 | FromDiscord | <Milerius> ๐ฎ |
08:54:19 | FromDiscord | <Milerius> Also, another question |
08:54:20 | FromDiscord | <Milerius> |
08:54:20 | FromDiscord | <Milerius> Is the equivalent of std::atomic_bool from c++ create a regular integer and nim and use atomicInc/atomicDec ? |
08:54:25 | FromDiscord | <Milerius> Or we have an atomic boolean ? |
08:54:44 | FromDiscord | <mratsim> @Araq I've been thinking on coroutine based multithreading. This one is a very efficient, very concise and also performant multithreading library based on whaat looks like coroutines: https://github.com/chaoran/fibril |
08:54:57 | FromDiscord | <mratsim> import std/atomics and use Atomic[bool] |
08:55:14 | FromDiscord | <Milerius> :OOOO |
08:55:16 | FromDiscord | <Milerius> Perfect |
08:55:20 | FromDiscord | <Milerius> thanks ratsim |
08:55:23 | FromDiscord | <mratsim> Actually it's the only library that is more efficient than mine on fibonacci ๐ |
08:56:04 | FromDiscord | <mratsim> it would be easier as well to mix async/await with spawn/sync |
08:56:35 | FromDiscord | <mratsim> but AFAIK the current design of weave still allows to switch to coroutines-based tasks |
08:56:39 | FromDiscord | <Milerius> @mratsim Where is the doc for atomics ? |
08:57:37 | * | clyybber joined #nim |
08:57:39 | FromDiscord | <mratsim> no docs, but C++ reference would work |
08:58:01 | FromDiscord | <mratsim> there are 2 competing atomics package and no final API was chosen |
08:58:04 | FromDiscord | <mratsim> you can read here: https://github.com/nim-lang/Nim/blob/devel/lib/pure/concurrency/atomics.nim |
08:58:20 | FromDiscord | <Milerius> I read but |
08:58:25 | FromDiscord | <Milerius> i don't understand how we set a value |
08:58:31 | FromDiscord | <Milerius> when i set = true it's not workin |
08:58:32 | FromDiscord | <Milerius> when i set = true it's not working |
08:58:42 | FromDiscord | <mratsim> foo.store(true, moRelaxed) |
08:58:52 | FromDiscord | <mratsim> if you want relaxed memory semantics |
08:59:21 | narimiran | Nim Community Survey 2019 is here! https://nim-lang.org/blog/2019/12/20/community-survey-2019.html |
08:59:35 | FromDiscord | <Milerius> ah nice |
08:59:41 | FromDiscord | <mratsim> here is a simple example of Atomic bool on SPSC channel: https://github.com/mratsim/weave/blob/master/unused/channels/channels_spsc_single_object.nim#L45 |
09:01:16 | Araq | the C++ memory model is quite good but the names are terrible |
09:01:36 | FromDiscord | <mratsim> fetchAdd and AddFetch ๐ |
09:01:41 | FromDiscord | <mratsim> and no fetchXor |
09:01:51 | FromDiscord | <mratsim> sorry fetchNeg |
09:03:36 | FromDiscord | <mratsim> btw, I started to use formal verification, I think a backend to a formal verification language 'maybe spin?) would be helpful |
09:04:12 | FromDiscord | <mratsim> I used TLA+ but it's higher level, both supports goto though |
09:04:46 | Araq | I planned to nimZ3 |
09:05:21 | FromDiscord | <mratsim> ah right |
09:05:50 | Araq | Z3 supports separation logic iirc and everything that lacks separation logic isn't future proof :P |
09:06:10 | FromDiscord | <mratsim> TLA+ can use isabelle or Z3 for proofs as well |
09:06:52 | FromDiscord | <mratsim> i.e. it does model checking (exhaustively check all states your application can be in and ensure no deadlock, livelocks or any other constraint you don't want violated) |
09:07:16 | FromDiscord | <mratsim> or it does proofs by deferring to a SMT like Z3 or a proof assistant like Isabelle |
09:07:37 | FromDiscord | <Milerius> @mratsim Are you using Thread Sanitize with nim? |
09:07:42 | FromDiscord | <Milerius> To verify that you are thread safe |
09:07:52 | FromDiscord | <mratsim> planned but not yet |
09:08:20 | FromDiscord | <mratsim> probably will be my own tool, I was thinking of the name "Lage Nim COllider" :p |
09:08:23 | FromDiscord | <Milerius> I'm supposing i can just link to check |
09:08:30 | FromDiscord | <mratsim> See: https://github.com/mratsim/weave/issues/18 |
09:08:31 | disbot | โฅ [Testing] Concurrency: Race detection / Model Checking / Formal Verification |
09:08:58 | Araq | so ... as I also asked on the forum, what does 'spawn' use ideally? |
09:09:04 | FromDiscord | <mratsim> for now I've used Valgrind/Helgrind but it's very noisy the output is not usable |
09:09:19 | FromDiscord | <mratsim> what do you mean by "what"? |
09:09:47 | FromDiscord | <mratsim> ah |
09:09:51 | FromDiscord | <mratsim> sink move or deepCopy |
09:12:17 | FromDiscord | <mratsim> It does like this "spawn fnCall(x, y, z)" |
09:12:17 | FromDiscord | <mratsim> x, y, z will be serialized into a task |
09:12:18 | FromDiscord | <mratsim> I create an "async_fnCall" function that is also referenced in the task and is just in charge of passing a pointer to the serialized x,y,z and returning the future: https://github.com/mratsim/weave/blob/master/weave/parallel_tasks.nim#L125-L150 |
09:13:53 | Araq | yeah I'm familiar with this idea |
09:15:21 | Araq | you use pointers for everything, right? thread local heaps are dead |
09:16:06 | FromDiscord | <mratsim> I have a thread-local context and a custom threadsafe memory pool |
09:16:53 | FromDiscord | <mratsim> when I refactor the thing in an explicit state machine I will reduce the context |
09:17:03 | FromDiscord | <mratsim> it's there: https://github.com/mratsim/weave/blob/master/weave/datatypes/context_thread_local.nim |
09:17:05 | FromDiscord | <Milerius> How we add a default flags when using nimble build ? |
09:17:15 | FromDiscord | <Milerius> i want to compile with --threads by default |
09:17:33 | FromDiscord | <mratsim> either you use a .cfg: https://github.com/mratsim/weave/blob/master/weave.cfg |
09:17:40 | FromDiscord | <mratsim> which will work with both nimble and nim |
09:17:49 | FromDiscord | <Milerius> Nice !! |
09:18:00 | FromDiscord | <mratsim> or you configure nimble with flags like this: https://github.com/mratsim/weave/blob/master/weave.nimble#L26 |
09:18:18 | FromDiscord | <mratsim> that would only apply to nimble commands |
09:18:55 | FromDiscord | <Milerius> i like cfg |
09:19:40 | FromDiscord | <Milerius> you need to specify the cfg to nimble ? |
09:19:57 | * | theelous3 quit (Ping timeout: 265 seconds) |
09:20:04 | FromDiscord | <mratsim> no |
09:20:06 | * | Vladar joined #nim |
09:20:11 | FromDiscord | <mratsim> the nim compiler picks it up automatically |
09:20:20 | FromDiscord | <Milerius> It's not working for me ๐ข |
09:21:14 | FromDiscord | <Milerius> (i mean nimble doesn't pickup the flags inside my cfg) |
09:21:17 | Araq | mratsim: what's on your opinion on this design: 'new' uses a shared memory heap but the RC ops are *non*atomic |
09:21:36 | FromDiscord | <mratsim> My memory management scheme is explained here: https://github.com/mratsim/weave/tree/master/weave/memory |
09:21:36 | FromDiscord | <mratsim> And the issues with cactus stacks and such here: https://github.com/mratsim/weave/blob/master/weave/memory/multithreaded_memory_management.md |
09:21:36 | FromDiscord | <mratsim> And the memory access patterns of the runtime here: https://github.com/mratsim/weave/blob/master/weave/memory/memory_access_patterns.md |
09:21:36 | FromDiscord | <mratsim> |
09:21:36 | FromDiscord | <mratsim> But in short my memory pool covers all my needs and its pointers all the way down. |
09:22:14 | FromDiscord | <mratsim> can't we have type FooShared {.atomic.} = ref object |
09:22:25 | FromDiscord | <mratsim> for non atomic ref counting |
09:22:35 | FromDiscord | <mratsim> and type FooTL = ref object |
09:22:50 | FromDiscord | <mratsim> for thread local ref counting so non-atomic? |
09:23:14 | Araq | we can do everything C++ can but we're getting into composability problems |
09:23:39 | FromDiscord | <mratsim> @milerius, it must be called with the same name as your nim file that imports everything |
09:23:49 | Araq | yes, ok so now I have shared_ref[T], can I put JSON inside it? |
09:24:39 | FromDiscord | <mratsim> I think it would be less likely to miss a use-case by listing use cases we want to support |
09:24:54 | Araq | (JSON is my favorite example because it's so common) |
09:25:15 | clyybber | Araq: You mean because json itself doesn't return shared_refs? |
09:25:17 | FromDiscord | <mratsim> I don't mind having non-atomic by default, atomic is costly |
09:26:32 | Araq | indeed it is |
09:26:59 | Araq | clyybber: exactly, we're sitting on a codebase full of refs |
09:27:18 | Araq | and as far as I'm aware so is almost everybody else |
09:27:28 | clyybber | Hmm, that is indeed a problem |
09:27:45 | Araq | it's also a problem in C++ and Rust btw |
09:27:57 | Araq | what pointer type to choose for my library |
09:28:16 | Araq | I've seen JSON implementations in C++ based on shared_ptr |
09:29:18 | clyybber | Ideally shared would be a top level type attribute like var or static |
09:29:29 | clyybber | But I don't know how that can work at construction |
09:30:08 | Araq | at the same time, pretending that you can "just use X" if only Nim had a shared heap and atomic refcounting is a terrible idea, all you do is to turn data races into race conditions |
09:31:18 | clyybber | Araq: Could a normal ref be promoted to an atomic ref? |
09:31:22 | Araq | take the Table[string, string] data structure and put a lock around it, it doesn't work. |
09:31:51 | Araq | because you cannot query a table about its size when it's concurrently being added to |
09:32:33 | * | watzon quit (Remote host closed the connection) |
09:33:01 | * | watzon joined #nim |
09:33:03 | Araq | clyybber: yes, we can traverse the subgraph and set a flag ("now shared!") |
09:33:08 | clyybber | Ok |
09:33:20 | clyybber | We can move normal refs around threads safely though |
09:33:22 | clyybber | Right? |
09:33:30 | clyybber | But only move |
09:33:35 | Araq | right |
09:33:48 | FromDiscord | <mratsim> concurrent collections need dedicated maintenance |
09:34:16 | FromDiscord | <mratsim> a data race detector would be nice as well |
09:34:19 | FromDiscord | <mratsim> (Go has one) |
09:34:29 | Araq | (I know) |
09:34:47 | Araq | race detection is far worse than race prevention though |
09:35:07 | clyybber | Araq: So with respect to threads a normal ref is like an owned ref and an shared ref like a normal ref |
09:35:16 | clyybber | weird analogy I know |
09:35:41 | Araq | clyybber: you can also assert ref.refcount == 1 before passing it to a thread |
09:36:11 | clyybber | Yeah |
09:37:00 | FromDiscord | <mratsim> I've noted race detection techniques here: https://github.com/mratsim/weave/issues/18#issuecomment-565858939 |
09:37:00 | FromDiscord | <mratsim> |
09:37:00 | FromDiscord | <mratsim> I'm pretty sure Go race detector is based on this: https://github.com/dvyukov/relacy as Dmitry Vyukov wrote the Go scheduling runtime as well (and also Tensorflow/Eigen scheduler) |
09:37:01 | disbot | โฅ [Testing] Concurrency: Race detection / Model Checking / Formal Verification |
09:37:49 | FromDiscord | <mratsim> there are links to writeups |
09:38:45 | clyybber | Araq: We need something like lent/sink for threads |
09:38:52 | FromDiscord | <mratsim> and Rust has this one which uses some techniques from a paper to limit state explosion: https://github.com/tokio-rs/loom |
09:39:13 | FromDiscord | <mratsim> @Clyybber, like Send/Sync? |
09:39:37 | clyybber | yeah |
09:39:48 | clyybber | I'm coming more from pony though, but its the same |
09:39:59 | FromDiscord | <mratsim> oh you did Pony? |
09:40:09 | clyybber | yeah |
09:40:14 | FromDiscord | <mratsim> but the behaviour: isolate and stuff are a bit to numerous |
09:40:45 | FromGitter | <alehander92> i think they were mostly a combination |
09:40:52 | FromGitter | <alehander92> of 2-3 orthogonal things |
09:41:35 | FromDiscord | <mratsim> ah I see |
09:43:05 | FromDiscord | <mratsim> @Clyybber: https://forum.nim-lang.org/t/5692#35488 |
09:43:37 | Araq | mratsim: I think I nailed this problem a couple of years ago with the .guard annotation for when you need locking/atomics and analysable array slices for true parallelism |
09:43:52 | FromGitter | <alehander92> https://tutorial.ponylang.io/reference-capabilities/capability-matrix.html |
09:44:08 | Araq | and nothing else comes close because it's a static mechanism |
09:44:13 | FromGitter | <alehander92> so it seems to me one could do it with less primitives |
09:44:21 | FromGitter | <alehander92> but yeah its still relatively many |
09:44:34 | FromGitter | <alehander92> but its more obvious why |
09:44:58 | Araq | the "disjoint check" is exactly what I want in reality and Z3 should give it us |
09:45:32 | Araq | *to us |
09:46:48 | Araq | clyybber: what do you mean by that? |
09:46:51 | Zevv | so did you ever get started with Z3? |
09:46:59 | Araq | "sink" and "lent" for threads? |
09:47:09 | clyybber | ownership basically |
09:47:10 | Araq | Zevv: I managed to build it... |
09:47:36 | Zevv | that's something |
09:48:24 | FromGitter | <alehander92> so is z3 in 2020 program |
09:48:28 | FromGitter | <alehander92> or 2021 |
09:49:35 | clyybber | Araq: Owned ref is equivalent to ponys iso. When we send it to another thread/actor nothing should point to it. It must also behave like a sink arg |
09:50:10 | clyybber | so we can't use it until it is returned to us again |
09:51:23 | Araq | in 2020 program because we're insane |
09:51:26 | * | fanta1 joined #nim |
09:51:47 | Araq | clyybber: same as unique_ptr, you can write it as a library in about 30 lines |
09:51:49 | FromDiscord | <mratsim> replied to detail task packaging: https://forum.nim-lang.org/t/5692#35490 |
09:52:09 | clyybber | Araq: Yeah |
09:53:44 | clyybber | I just had an idea for an optimization for atomic ref counting. |
09:54:31 | clyybber | Each thread stores its own non atomic thread local refcount along it, and the atomic refcount only gets decremented when the thread local refcount is 0 |
09:54:40 | * | Trustable joined #nim |
09:55:29 | Araq | yeah, known to me |
09:55:30 | FromDiscord | <mratsim> that means that all threads need to keep a hashtable though |
09:57:20 | Araq | problem with optimizing RC ops is that I'm naive and believe in hardware. eventually atomicInc will have the cost as inc if there no contention |
09:58:01 | Araq | so far this doesn't happen though for reasons I don't know, plenty of runtimes are betting on refcounting |
09:58:23 | Araq | Python, PHP, Perl, Swift, C++, Rust, ... |
09:59:05 | * | narimiran quit (Quit: leaving) |
09:59:26 | FromDiscord | <mratsim> on x86 atomicInc relaxed is the same cost of inc |
09:59:44 | Araq | not on my benchmarks, it was significantly slower |
09:59:46 | FromDiscord | <mratsim> the high cost is because you need to flush and reload the cache |
10:00:05 | Araq | no, the cache is ok, it's the write buffer that gets flushed |
10:03:59 | Araq | mratsim: anyhow, the real underlying issues are: |
10:04:10 | Araq | - how can I use weave with async? |
10:04:47 | Araq | - can weave replace async? |
10:05:20 | Araq | - how to make it work well with Nim's strings/seqs, maybe refs |
10:07:34 | Araq | - how to use it with openArray |
10:09:00 | FromDiscord | <mratsim> I don't know (for all of those) |
10:09:38 | FromDiscord | <mratsim> 1. Async is a complex beast as well and i'd rather have cheatfate work on it or someone who deals with it on a day to day basis |
10:09:53 | FromDiscord | <mratsim> I can only make sure we work well by providing good channels primitives |
10:10:04 | FromDiscord | <mratsim> and allow event loop in threads or spawning threads from event loops |
10:10:44 | FromDiscord | <mratsim> strings/seq/refs: depends on the GC: that's probably the hardest. I looked into the nim channels implementation and I was completely lost |
10:11:05 | FromDiscord | <mratsim> openarray should work as long as we can have them as values |
10:11:49 | FromDiscord | <mratsim> however, the escape analysis is a bit harder and you would need a "sync" before returning |
10:11:59 | FromDiscord | <mratsim> to ensure there is no escape of the pointer |
10:12:31 | Araq | I know, that's why there is 'parallel' + 'spawn' in Nim, spawn alone doesn't cut it |
10:13:24 | Araq | it's also where concurrency and parallelism diverge, parallelism is like "structured programming" for me, in the end there is a 'join' |
10:13:56 | FromDiscord | <mratsim> in the end, I started without those answers and by avoiding to requiring them because it's too hard |
10:14:02 | FromGitter | <alehander92> https://plg.uwaterloo.ca/~migod/papers/2019/scam19.pdf might be interesting |
10:15:45 | clyybber | looks like a scammy link :p |
10:18:46 | FromGitter | <alehander92> A Study on the Effects of Exception Usagein Open-Source C++ Systems |
10:18:51 | FromGitter | <alehander92> yeah, its strange :P |
10:21:21 | Araq | skimmed it, but doesn't look that interesting, sorry |
10:21:46 | Araq | also, once again: I don't even like exceptions anyway, it's just that the proposed alternatives are worse |
10:22:26 | FromGitter | <alehander92> yeah, i mostly like the methodology, its useful to build more tools enabling some kind of metrics on corpuses of code |
10:23:00 | Araq | and the points brought up against them are often *objectively* wrong. |
10:23:41 | FromGitter | <alehander92> lang design can use some more "data" in decisions, but its very hard to measure it |
10:27:12 | Araq | maybe some day I'll finish my "quirky exceptions", the C backend seriously needs it |
10:28:00 | Araq | mratsim: maybe 'spawn f(args)' is the wrong idea too, the args have marshalling semantics in |
10:28:05 | Araq | - your implementation |
10:28:08 | Araq | - my implementation |
10:28:31 | Araq | - for async too (cannot use a 'var T' over there either) |
10:29:17 | Araq | it's cute syntax but maybe we are better off with an explicit task type that programmers are responsible for |
10:29:39 | Araq | easier to implement, clearer cost model |
10:31:43 | FromDiscord | <mratsim> or both |
10:32:39 | clyybber | disruptek: 10 now https://github.com/nim-lang/packages/pull/1280/files :p |
10:32:40 | disbot | โฅ Fix vcs protocol for diff |
10:32:47 | FromDiscord | <mratsim> I have both implemented in TBB, the closure approach takes 600ms on my machine on fib(40) and 1000ms with the task approach: |
10:32:47 | FromDiscord | <mratsim> |
10:32:47 | FromDiscord | <mratsim> https://github.com/mratsim/weave/blob/master/benchmarks/fibonacci/tbb_class_fib.cpp |
10:32:47 | FromDiscord | <mratsim> |
10:32:47 | FromDiscord | <mratsim> https://github.com/mratsim/weave/blob/master/benchmarks/fibonacci/tbb_closure_fib.cpp |
10:32:57 | FromDiscord | <mratsim> the task approach is also very verbose |
10:33:24 | Araq | verbosity is where Nim shines, you can always hide it via macros |
10:33:49 | FromGitter | <alehander92> but those macros might end up looking as spawn f(args) :P |
10:33:49 | FromDiscord | <mratsim> also var T on multithreading is bad anyway |
10:34:21 | Araq | alehander92: yes but then the underlying task structure remains exposed |
10:34:31 | FromDiscord | <mratsim> go disables it, you have to use channels |
10:34:49 | FromDiscord | <mratsim> it's not composable also, if you want to do "andThen" |
10:34:54 | Araq | what? Go doesn't have references anyway, only pointers |
10:37:10 | FromGitter | <alehander92> the task thing does sound interesting |
10:37:31 | FromGitter | <alehander92> if its easy to sugar-ize it for the simple usecases |
10:41:34 | * | endragor quit (Read error: Connection reset by peer) |
10:41:34 | * | endragor_ joined #nim |
10:42:37 | Araq | also what sometimes bothers me: f(a, b, c) is itself not composable, in stack based languages it's push a; push b; push c; call f |
10:43:13 | Araq | and it's rather easy to push to somewhere else (a channel?) |
10:44:02 | Araq | assembler is much more flexible than C code, calling C a "portable assembler" means you have no clue about assembler |
10:44:34 | FromGitter | <alehander92> hm, but how do you want to compose |
10:45:04 | Araq | for example, I wrote a VM, it needs to support calling into native code |
10:45:31 | Araq | the calling convention is known. at runtime. enjoy doing that with C (or C++, Nim, D...) |
10:46:28 | FromDiscord | <mratsim> The whole point of weave was to be usable from JIT code |
10:46:40 | PMunch | Hmm, why doesn't this work? https://play.nim-lang.org/#ix=24Vb |
10:46:43 | FromDiscord | <mratsim> because I want to JIT some linear algebra kernels |
10:46:45 | PMunch | Sure x is static.. |
10:47:51 | PMunch | s/(Sure)/\1ly/ |
10:50:13 | Araq | PMunch: it's not static enough |
10:50:27 | Araq | const x = 100 should work |
10:50:56 | PMunch | Not static enough? |
10:56:51 | clyybber | Araq: How would I prepend an element in your owned ref doubly-linked list? |
10:57:39 | Araq | via proc prepend. what's the problem? |
10:59:59 | clyybber | If we do `head = Node(value: newValue, next: head)` that wont work |
11:01:17 | Araq | alehander92: |
11:01:24 | Araq | however, popular async frameworks for the Rust programming language, such as tokio.rs, have also chosen to incorporate error handling directly into their Future constructs, because doing so was found to be more practical and ergonomic than trying to compose theoretically-orthogonal Future<T> and Result<T> constructs." |
11:01:31 | Araq | from https://gist.github.com/lattner/429b9070918248274f25b714dcfc7619 |
11:01:53 | Araq | in other words, Result<T> is junk that doesn't really work... ;-) |
11:02:31 | FromGitter | <sheerluck> hi all. I stumbled upon funny thing. I have working code with `template until(cond: typed): typed = if cond: break` from https://forum.nim-lang.org/t/1970 โ But as soon as I add the line `import strutils` nim says "Error: invalid control flow: break" |
11:03:03 | Araq | sheerluck: import struilts except until |
11:03:11 | FromGitter | <sheerluck> oh. Thank you |
11:03:15 | Araq | but don't use 'until', write real Nim code please |
11:03:49 | Araq | templates and macros don't exist just because you cannot let go of Rubyisms |
11:04:21 | Araq | or of Pascal (do we have people coming from Pascal?) |
11:04:52 | Araq | clyybber: well 'head' is the last read |
11:05:09 | Araq | as it gets overwritten just after that |
11:05:18 | Araq | there is some support for this in the DFA |
11:05:34 | FromGitter | <sheerluck> @Araq You've convinced me. I will fix my code immediately. |
11:06:02 | Araq | wow, Christmas is near |
11:06:10 | Araq | gotta buy a tree, bbl |
11:11:48 | FromGitter | <alehander92> yeeey |
11:12:03 | FromGitter | <alehander92> otherwise Araq, interesting link ill read more of it later |
11:12:06 | FromGitter | <alehander92> thanks |
11:12:52 | * | sealmove joined #nim |
11:16:55 | FromDiscord | <Milerius> Hello, i'm discovering thread in nim: |
11:16:55 | FromDiscord | <Milerius> |
11:16:55 | FromDiscord | <Milerius> https://gist.github.com/Milerius/bf2884fba202c911c2a32e02b4565447 |
11:16:55 | FromDiscord | <Milerius> |
11:16:55 | FromDiscord | <Milerius> I know i'm doing something wrong, (i'm trying to execute a task every 30s in my background thread) |
11:16:56 | FromDiscord | <Milerius> |
11:16:58 | FromDiscord | <Milerius> What is the idiomatic way according to my code snippet ? |
11:19:13 | dom96 | https://nim-lang.org/blog/2019/12/20/community-survey-2019.html |
11:19:24 | dom96 | Has narimiran created this from scratch? |
11:29:50 | federico3 | one response per row for the tools? odd |
11:36:44 | * | marmotin_ joined #nim |
11:37:25 | FromDiscord | <mratsim> is there an issue for the templates eating stacktraces? That's so annoying |
11:37:26 | * | marmotini_ quit (Read error: No route to host) |
11:41:31 | * | jonafato quit (Quit: ZNC - http://znc.in) |
11:42:55 | * | jonafato joined #nim |
11:46:55 | FromGitter | <alehander92> mratsim i have that "runtime stacktrace including macro expansion points" idea started in a branch somewhere |
11:47:19 | FromGitter | <alehander92> but for now it mostly generates info that i use in gdb |
11:54:17 | clyybber | Araq: It fails to compile though. |
11:56:25 | clyybber | seems like a dumb bug though |
12:00:06 | * | marmotin_ quit (Read error: Connection reset by peer) |
12:00:48 | * | marmotini_ joined #nim |
12:01:58 | * | luis_ joined #nim |
12:06:26 | clyybber | Araq: See #12941 |
12:06:28 | disbot | https://github.com/nim-lang/Nim/issues/12941 -- 3Newruntime last read analysis broken ; snippet at 12https://play.nim-lang.org/#ix=24VA |
12:12:14 | FromGitter | <bung87> how to handle this `"en1๏ฟฝ\x13\b\x06๏ฟฝ@โ` |
12:12:48 | FromGitter | <bung87> when echo a string converted from a cstring |
12:15:04 | FromDiscord | <mratsim> @dom96 wasn't that fixed in nimble 0.11? https://github.com/fragcolor-xyz/nimtorch/issues/18#issuecomment-565824215 |
12:15:05 | disbot | โฅ Nimble installation fails |
12:16:22 | * | luis_ quit (Ping timeout: 265 seconds) |
12:18:46 | FromDiscord | <niv> hello. where could i go for some sample code and/or guidance to make a C-imported function awaitable? |
12:19:18 | * | Vladar quit (Quit: Leaving) |
12:20:09 | FromGitter | <sheerluck> I have completed my toy project https://github.com/sheerluck/Toy-Nim-Project-with-Kaitai โ I would like to thank โ โ 1) @sealmove (Stefanos Mandalas) for KaitaiStruct Runtime Library for Nim โ 2) @solitudesf for letting me print inside pure functions with debug_echo ... [https://gitter.im/nim-lang/Nim?at=5dfcbc7944e1fb33f6fb46e2] |
12:20:58 | sealmove | wow sheerluck, what does it do? |
12:21:11 | FromDiscord | <mratsim> you should rename it to video downloader or what you are doing with it |
12:21:54 | sealmove | how did you parse ksy? |
12:22:04 | FromDiscord | <mratsim> one day I'll write a video processing tool in Nim. The current tools are meh |
12:22:49 | clyybber | mratsim: How do you reference repo code from an issue? |
12:23:01 | FromGitter | <sheerluck> @sealmove it just walks path and prints top10 longest movies (mkv+webm+mp4) |
12:23:10 | clyybber | I pasted the link with #L123-#L456 but it just appears as a link |
12:23:32 | sealmove | how did you parse ksy? |
12:23:40 | FromDiscord | <mratsim> right click on the line and get permalink or highlight lines, press Y and copy the URL |
12:23:55 | FromGitter | <sheerluck> @sealmove I cheated I just ported generated code from c++ :( |
12:23:55 | clyybber | thanks |
12:23:56 | FromDiscord | <mratsim> you need a precise commit or tags for github to inline the code |
12:24:01 | clyybber | ah, ok |
12:24:07 | FromDiscord | <mratsim> master:devel won't work |
12:24:11 | FromDiscord | <mratsim> v1.0.4 would |
12:24:40 | * | luis_ joined #nim |
12:25:12 | sealmove | sheerluck: ah, ok, hope you can use nimitai soon |
12:25:20 | sealmove | i am making progress |
12:25:34 | sealmove | ~10/132 pass right now |
12:25:40 | clyybber | mratsim: Doesn't seem to work: https://github.com/nim-lang/Nim/issues/12941 |
12:25:41 | disbot | โฅ Newruntime last read analysis broken ; snippet at 12https://play.nim-lang.org/#ix=24VA |
12:26:14 | * | luis_ quit (Client Quit) |
12:26:33 | clyybber | oh |
12:26:34 | FromDiscord | <mratsim> edited in |
12:26:35 | clyybber | now it works |
12:26:39 | clyybber | ah, thanks! |
12:27:02 | clyybber | ah, so it was one hashtag too many |
12:27:36 | Araq | clyybber: we don't try to analyse global vars |
12:28:00 | clyybber | Hmm |
12:28:09 | clyybber | I think I can reproduce it without a global var, let me see. |
12:28:24 | * | luis_ joined #nim |
12:29:17 | * | luis_ quit (Client Quit) |
12:29:20 | clyybber | ah, nevermind |
12:36:47 | * | nsf quit (Quit: WeeChat 2.6) |
12:37:18 | clyybber | Araq: Btw, your append proc in your RFC is broken |
12:41:02 | Araq | why? |
12:41:30 | clyybber | It doesn't compile |
12:41:32 | clyybber | dangling refs |
12:41:43 | clyybber | I can correct it if you want |
12:42:01 | clyybber | or send the correct variant |
12:42:44 | clyybber | Araq: This is how it should look I think: https://hastebin.com/fomexaciso.php |
12:42:52 | clyybber | oh |
12:43:00 | clyybber | nevermind, wrong paste |
12:45:14 | clyybber | Araq: Here it is: http://ix.io/24VK |
12:46:07 | FromGitter | <iffy> @zacharycarter what's that you're making? |
12:48:20 | * | xet7 quit (Quit: Leaving) |
12:50:07 | FromDiscord | <mratsim> @iffy, I'm looking into keyring, nice. THis might be relevant for you: https://github.com/status-im/nim-beacon-chain/issues/545 though we don't have a solution for secure heap management |
12:50:08 | disbot | โฅ Protection of users private keys |
12:50:12 | * | xet7 joined #nim |
12:51:52 | FromDiscord | <mratsim> Go is adding macros: https://github.com/dave/jennifer |
12:52:52 | lqdev[m] | no, it's not :) it's a separate generator. I'd be surprised if they actually merged it into mainstream, but I know they won't. |
12:53:04 | FromDiscord | <mratsim> of course I was joking ๐ |
12:53:20 | FromDiscord | <Milerius> PMunch are you around ? :p |
12:55:59 | PMunch | Yup |
12:56:07 | PMunch | Always :P |
12:56:16 | FromDiscord | <Milerius> according to: https://gist.github.com/Milerius/6a72ca18eace612ea5d27ace7f20b74e |
12:56:16 | FromDiscord | <Milerius> |
12:56:16 | FromDiscord | <Milerius> is possible to represent correctly the json using jsonschema ? |
12:56:40 | FromDiscord | <Milerius> my json can be success.json or error.json |
12:57:54 | PMunch | What is ElectrumAnswer supposed to be? |
12:58:09 | FromDiscord | <Milerius> Either success.json or error.json |
12:58:12 | FromDiscord | <Milerius> may be i did it wrong |
12:58:34 | PMunch | Yeah.. You can't have an object that's either one kind or another |
12:58:41 | FromDiscord | <Milerius> When i receive success.json i would like to have ElectrumAnswerSuccess, otherwise ElectrumAnswerError |
12:58:53 | PMunch | But you can do answer: ElectrumAnswerSuccess or ElectrumAnswerError |
12:59:03 | FromDiscord | <Milerius> yeah but i don't have field answer |
12:59:10 | FromDiscord | <Milerius> The rpc is not from me :/ |
12:59:24 | PMunch | Then you need to create the types and use isValid to check which one it is |
12:59:43 | FromDiscord | <Milerius> ok ! |
12:59:51 | FromDiscord | <Milerius> Thank's for explanation ! |
13:00:29 | PMunch | Note that isValid takes a paremeter "allowExtra" which dictates if extra fields is an error or not |
13:00:55 | FromDiscord | <Milerius> Oh this is cool |
13:02:00 | PMunch | I guess the extends mechanism could be expanded to include `or` functionality |
13:02:12 | FromDiscord | <Milerius> It's will be insane ! |
13:02:23 | FromDiscord | <Milerius> For one specific reason |
13:02:33 | FromDiscord | <Milerius> If i want to store it in a container for Example |
13:02:43 | FromDiscord | <Milerius> It's will allow me to do: container[ElectrumAnswer] |
13:02:56 | PMunch | Ah, true |
13:04:53 | FromDiscord | <Milerius> I would love to help you integrate the functionnality, but i'm really a beginner in nim, i read all your code already |
13:04:57 | FromDiscord | <Milerius> But it's really advanced ^^' |
13:05:12 | PMunch | Haha, yeah the jsonschema module is quite messy.. |
13:05:15 | FromDiscord | <Milerius> (bit magic for mec) |
13:05:18 | FromDiscord | <Milerius> (bit magic for me) |
13:05:29 | PMunch | TBH it's a bit magic to me as well.. |
13:06:13 | FromDiscord | <Milerius> Yup i understand |
13:06:20 | FromDiscord | <Milerius> Maybe what can i do is |
13:06:23 | FromDiscord | <Milerius> when i receive the json |
13:06:33 | FromDiscord | <Milerius> I can put the whole contents into answer |
13:06:40 | FromDiscord | <Milerius> But it's will be a bit inneficient |
13:06:50 | FromDiscord | <Milerius> Especially for big json |
13:08:00 | PMunch | I mean for putting it in a container you can just cast it back to JsonNode |
13:08:13 | PMunch | That's free (same object in memory) |
13:08:25 | PMunch | And manually cast it when you get it out |
13:08:33 | PMunch | (This can of course be hidden with some templates) |
13:08:48 | FromDiscord | <Milerius> Or i can use the equivalent of std::variant ? |
13:08:50 | FromDiscord | <Milerius> in nim |
13:09:00 | PMunch | Yeah, that is another option |
13:09:02 | FromDiscord | <Milerius> Container = TypeA or TypeB |
13:09:10 | FromDiscord | <Milerius> it's work this way ? |
13:09:31 | PMunch | Depends |
13:09:38 | PMunch | On what you actually want to do |
13:09:53 | FromDiscord | <Milerius> well i really want |
13:10:10 | FromDiscord | <Milerius> electrum["error"].isSome: |
13:10:54 | PMunch | Hmm |
13:11:01 | PMunch | https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
13:11:09 | PMunch | That is one option, but it's a bit much for this.. |
13:12:47 | * | xet7 quit (Read error: Connection reset by peer) |
13:13:19 | * | xet7 joined #nim |
13:14:03 | FromDiscord | <Milerius> Yup anyway i will consider that is success |
13:14:08 | FromDiscord | <Milerius> :p |
13:14:20 | FromDiscord | <Milerius> But if you implement the include functionnality |
13:14:22 | FromDiscord | <Milerius> let me know |
13:14:39 | PMunch | Will do |
13:14:56 | * | marmotini_ quit (Remote host closed the connection) |
13:14:56 | * | xet7 quit (Read error: Connection reset by peer) |
13:15:07 | PMunch | Looking at the code now and trying to figure out what that would actually look like |
13:15:31 | * | xet7 joined #nim |
13:15:45 | FromGitter | <bung87> `"bridge0๏ฟฝ\x13\b\x06๏ฟฝAโ` how to handle this? print to console , converted from cstring |
13:15:46 | FromDiscord | <Milerius> (if it's possible without specifying a name field) |
13:16:23 | PMunch | bung87, you ace probably given a length somewhere |
13:16:30 | FromGitter | <Willyboar> sealmove are you greek? |
13:17:04 | sealmove | yup |
13:17:12 | PMunch | Or that string is meant to mean something special |
13:17:14 | FromGitter | <Willyboar> me too |
13:17:22 | sealmove | nice |
13:18:50 | sealmove | there is at least another one, "planetis" |
13:19:19 | FromGitter | <Willyboar> I think i saw one in the forum |
13:19:21 | sealmove | and another one from Cyprus (forgot nickname) |
13:19:47 | FromGitter | <bung87> `name = castcstring (sdl.sdl_data.addr) ` then `$name ` |
13:19:55 | FromGitter | <Willyboar> drkameleon |
13:23:11 | lqdev[m] | sealmove, Willyboar: planetis is on irc too. he uses matrix. |
13:23:30 | Araq | oh I just realized it's PR friday |
13:24:34 | clyybber | Araq: I think we'll have to decide between deep-immutability or deep-copy for multithreading |
13:24:41 | clyybber | it accomplishes the same task |
13:24:58 | Araq | Nim v1 says we do deep copies |
13:25:42 | clyybber | I know, what will we do in the future? |
13:25:53 | Araq | I like neither though, I like unique-ness and move semantics |
13:25:59 | clyybber | Me too |
13:26:30 | clyybber | Araq: Btw, pony uses owned refs moving and stuff too |
13:26:44 | clyybber | Like their iso thing is exactly like owned ref |
13:26:51 | clyybber | and their ref, well. Its like ref |
13:27:13 | Araq | can you have a ref inside an iso? |
13:27:27 | clyybber | Lemme see.. |
13:28:46 | FromGitter | <zacharycarter> @iffy - 3d rts |
13:28:47 | clyybber | Araq: Yeah, but you cant read or write to it |
13:28:55 | clyybber | its a "tag" only used for identity |
13:30:34 | Araq | doesn't sound that useful |
13:30:58 | FromGitter | <zacharycarter> I really want to know what disruptek thinks about the improvement |
13:31:51 | clyybber | Araq: You can convert the iso to a ref though |
13:32:07 | clyybber | And then you can access it normally |
13:32:18 | clyybber | afterwards you can recover it as a iso again |
13:34:13 | Araq | how does it do that? |
13:34:20 | clyybber | It has a recover statement |
13:34:32 | clyybber | Its like a block statement |
13:34:36 | clyybber | which returns an owned ref |
13:35:25 | Araq | https://stdlib.ponylang.io/json--index/#sending-json |
13:35:38 | Araq | but how does 'recover' work? runtime check? |
13:36:02 | clyybber | And inside it you can have result be some unowned ref. The ref is not allowed to be referenced by variables from outer scopes though, and this way they can guarantee that it is convertible to owned ref/iso |
13:36:07 | clyybber | Araq: No at compile time |
13:36:20 | clyybber | Its a smart idea. |
13:36:21 | FromGitter | <Willyboar> @narimiran no PHP in the survey? :P |
13:37:17 | Araq | clyybber: for sure, but I don't understand it |
13:37:44 | clyybber | Araq: https://tutorial.ponylang.io/reference-capabilities/recovering-capabilities.html |
13:37:50 | clyybber | This explains it a bit better than I can |
13:38:28 | clyybber | This means that when the recover expression finishes, any aliases to the result of the expression other than iso, val and tag ones wonโt exist anymore. That makes it safe to โliftโ the reference capability of the result of the expression. |
13:38:46 | clyybber | Quote from that link |
13:39:30 | sealmove | ponylang is still active? |
13:39:54 | FromGitter | <kaushalmodi> Milerius: I just `exec("curl ..")` |
13:40:20 | FromGitter | <kaushalmodi> Milerius: https://github.com/kaushalmodi/nim_config/blob/bda6f591a0cdd1ff2f158882a31dcc921eb103ba/config.nims#L168-L172 |
13:40:47 | * | endragor_ quit (Remote host closed the connection) |
13:42:01 | FromGitter | <Willyboar> @sealmove looks like it is, they have a release few days ago |
13:42:08 | * | nsf joined #nim |
13:42:40 | Araq | clyybber: I think it only works when Pony already knows json.parse returned an iso |
13:44:13 | clyybber | No, it works also when f() would return a ref |
13:45:57 | clyybber | Araq: Inside a recover block you can't use variables from outer scopes to alias the result, that means when the recover block is finished the result can be safely turned into an owned ref |
13:46:20 | Araq | yeah I understand this part but it's not enough |
13:46:30 | Araq | you also need to know the constructors |
13:46:31 | clyybber | Yeah, it works in pony because refs cannot be shared |
13:46:38 | clyybber | Araq: Why? |
13:47:03 | Araq | and it looks like this is known by ^ " A constructor always returns an ephemeral type, because itโs a new object." |
13:48:29 | * | endragor joined #nim |
13:50:10 | clyybber | Araq: Yeah, if you think about it in nim terms it seems unneccessary, its kind of like a workaround for the fact that their constructors dont return an owned ref |
13:50:39 | Araq | they seem to return the roof though (^) |
13:52:49 | Araq | ah but I think I still misunderstand it |
13:53:08 | * | endragor quit (Remote host closed the connection) |
13:53:11 | Araq | so ... recover cannot access any location from outside? |
13:53:17 | clyybber | Nope |
13:53:35 | clyybber | No refs |
13:53:40 | Araq | string literals? |
13:54:05 | clyybber | Yeah |
13:54:09 | clyybber | Its not from outside |
13:54:16 | clyybber | Since its created |
13:54:28 | Araq | how can I parse json and recover it to be an iso? |
13:55:34 | clyybber | `recover json.parse` |
13:55:57 | clyybber | Though that doesn't make sense in pony.. |
13:56:10 | Araq | // sending an iso doc |
13:56:10 | Araq | let json_string = "{\"array\":[1, true, null]}" |
13:56:10 | Araq | let sendable_doc: JsonDoc iso = recover iso JsonDoc.>parse(json_string)? end |
13:56:12 | Araq | some_actor.send(consume sendable_doc) |
13:56:23 | Araq | https://stdlib.ponylang.io/json--index/#sending-json |
13:57:04 | Araq | problem is that the JSon could be in a file and then you have pray file wasn't modelled as 'ref' |
13:57:29 | clyybber | Yeah |
13:57:38 | clyybber | But you can prove it at compile time |
13:57:45 | clyybber | But yeah thats the gist |
13:58:03 | clyybber | don't use refs from outside and what you'll be left with can be safely turned into an owned ref |
13:58:41 | Araq | definitely a new insight |
13:58:47 | clyybber | yeah |
13:58:50 | clyybber | seems useful |
13:59:36 | clyybber | I think it should be possible to do it transparently implicitly |
13:59:54 | clyybber | In static analysis |
14:00:16 | clyybber | For nim this could mean we could make working with owned ref much simpler |
14:00:18 | clyybber | easier |
14:00:32 | clyybber | By implcitly unowning it and recovering it again |
14:00:40 | * | akitoshi joined #nim |
14:02:15 | clyybber | This is really cool and makes me all excited about newruntime with owned refs again :D |
14:04:16 | * | fanta1 quit (Quit: fanta1) |
14:05:00 | Araq | too early. B/D is both simpler and avoids a cycle collector |
14:05:26 | Araq | hard to beat |
14:07:03 | * | krux02 joined #nim |
14:12:49 | PMunch | Hmm, interesting: http://ix.io/24VW/ |
14:14:13 | FromGitter | <alehander92> sealmove: yes stefanos82 is from cyprus iirc |
14:14:48 | FromGitter | <alehander92> i and several other people are from bulgaria, so we almost can do a meetup :D |
14:15:19 | FromGitter | <alehander92> clyybber, interesting, one thing i wonder is how often is `tag` useful in pony |
14:15:51 | Araq | I don't really understand it so it must be wrong. |
14:16:00 | Araq | (kidding, of course) |
14:16:09 | * | leorize quit (Quit: WeeChat 2.6) |
14:36:29 | disruptek | hearts and minds, people; hearts and minds! |
14:38:59 | * | tane joined #nim |
14:39:19 | disruptek | i can't get out of a hardware store without spending $200 and i can't implement any new nimph feature without adding 200 lines. |
14:40:29 | * | PMunch quit (Quit: Leaving) |
14:41:37 | FromGitter | <zacharycarter> disruptek: did you see the map rendering improvements I shared last night? |
14:42:09 | FromGitter | <zacharycarter> curious about your thoughts on them |
14:42:36 | ldlework | zacharycarter you still working on your game engine? |
14:42:43 | disruptek | no, sorry, irssi reset. where are they? |
14:42:52 | FromGitter | <zacharycarter> I'll re-post |
14:43:08 | FromGitter | <zacharycarter> https://imgur.com/a/PYEBMNJ |
14:43:15 | FromGitter | <zacharycarter> and here's a short video |
14:43:33 | FromGitter | <zacharycarter> https://imgur.com/a/9vFj0J7 |
14:43:37 | FromGitter | <zacharycarter> vs before |
14:43:50 | FromGitter | <zacharycarter> https://i.imgur.com/SC4WiAJ |
14:44:07 | dom96 | That's awesome :) |
14:44:12 | FromGitter | <zacharycarter> thanks :D |
14:45:44 | FromGitter | <zacharycarter> ldlework: no, actually working on build a game now :) |
14:46:07 | FromGitter | <zacharycarter> but still writing a lot of the plumbing code myself |
14:49:40 | * | Vladar joined #nim |
14:57:28 | disruptek | wow, that's /much/ better. |
14:57:51 | FromGitter | <zacharycarter> thanks! |
14:58:13 | disruptek | i always wondered how they did that. ๐ |
14:58:18 | FromGitter | <zacharycarter> those two techniques combined - procedural stochastic texturing and triplanar mapping really worked well together |
14:58:31 | disruptek | yeah, it's night and day. |
14:59:03 | disruptek | one of those things that we noticed right away when it started arriving in games. |
14:59:15 | FromGitter | <zacharycarter> yeah |
15:02:29 | disruptek | thanks for sharing this stuff with us. it's really inspirational. ๐ |
15:04:15 | * | ng0_ joined #nim |
15:04:21 | * | ng0 quit (Disconnected by services) |
15:04:23 | * | ng0_ is now known as ng0 |
15:06:42 | dom96 | zacharycarter: what kind of game are you working on? Looks like an RTS to me |
15:07:47 | clyybber | bbl |
15:07:54 | * | clyybber quit (Quit: WeeChat 2.7) |
15:08:50 | shashlick | dom96: saw the file name issue, will fix, meanwhile what else needs to be done for a choosenim release? |
15:09:31 | dom96 | 0.5.0 has technically only just been released, we might want to wait a bit before making another release |
15:13:40 | FromGitter | <zacharycarter> dom96: yup! |
15:13:54 | * | leorize joined #nim |
15:13:56 | FromGitter | <zacharycarter> disruptek: haha of course, I appreciate the positive feedback |
15:14:32 | FromGitter | <alehander92> this is too complicated for me |
15:14:44 | FromGitter | <alehander92> you literally said like two unclear words for me in one sentence |
15:15:10 | * | Hideki joined #nim |
15:15:33 | * | Hideki is now known as Guest52746 |
15:18:16 | FromGitter | <zacharycarter> :P I didn't know about them until yesterday |
15:18:37 | FromGitter | <zacharycarter> https://www.martinpalko.com/triplanar-mapping/ |
15:18:42 | FromGitter | <zacharycarter> https://blogs.unity3d.com/2019/02/14/procedural-stochastic-texturing-in-unity/ |
15:18:56 | * | dddddd joined #nim |
15:20:45 | dom96 | zacharycarter: written in Nim? using any engine or doing everything yourself? |
15:22:38 | FromGitter | <zacharycarter> written in Nim and doing everything myself |
15:22:53 | FromGitter | <zacharycarter> using a few libraries - like bgfx etc |
15:24:02 | dom96 | Cool. I'm currently finishing off a Nim game written in SDL2, implementing so many drawing primitives has been a pain. |
15:24:25 | FromGitter | <zacharycarter> nice! |
15:25:12 | FromGitter | <zacharycarter> yeah - this terrain renderer has taken quite a bit of my time, but I think it's worth it - starting to look decent enough to actually use in a game |
15:25:27 | * | silvernode joined #nim |
15:25:31 | FromGitter | <zacharycarter> and if I can get PBR materials in, it will really pop |
15:27:28 | FromDiscord | <mratsim> PBR? is taht the raytracing book? |
15:27:49 | * | luis_ joined #nim |
15:28:23 | FromGitter | <zacharycarter> I think the raytracing book does implement PBR - but it's really just a shading model |
15:28:47 | FromGitter | <zacharycarter> so they're not 1:1 you can have PBR materials and not have raytracing |
15:34:11 | * | luis_ quit (Quit: luis_) |
15:38:14 | madprops | apparently some people find nim's crown creepy lol |
15:38:20 | Yardanico | what |
15:38:37 | madprops | "the crown is creepy and so was the previous name, Nimrod." |
15:39:20 | Araq | well we're getting a new mascot |
15:39:28 | Yardanico | really? |
15:39:32 | Yardanico | or :D |
15:39:36 | Araq | no. |
15:39:44 | madprops | the logo is perfect as it is |
15:40:11 | madprops | with that font |
15:40:56 | federico3 | dom96: are you using *GL stuff or plain SDL? |
15:42:38 | leorize | Araq: is there a way to make the current GC no longer requiring NimMain? This would be useful in making LD_PRELOAD libraries, where you hijack symbols in the target binary so NimMain can't be called |
15:43:04 | leorize | or should I just update to devel and use --gc:arc to get away from all that? |
15:43:04 | Araq | leorize: use --gc:arc already |
15:43:33 | FromDiscord | <mratsim> Come, the crown is reasonable, have they seen gopher or Ferris the crab |
15:43:37 | FromDiscord | <mratsim> on* |
15:44:48 | dom96 | federico3, plain SDL |
15:44:50 | Yardanico | python's one is literally a snake XD |
15:44:57 | federico3 | ouch |
15:45:02 | dom96 | Anyone else find this sort of thing incredibly frustrating? https://play.nim-lang.org/#ix=24Wf |
15:45:14 | Yardanico | lenientops ? |
15:46:02 | dom96 | ahh yes, I keep forgetting about this module. |
15:46:14 | dom96 | Makes me uneasy about what else it allows though |
15:46:53 | federico3 | dom96: there's a wrapper for sdl-gpu https://vladar4.github.io/sdl2_nim/sdl_gpu.html |
15:47:17 | dom96 | federico3, it's a 2D game, raw SDL2 isn't so bad |
15:47:29 | federico3 | :-/ |
15:48:34 | dom96 | I was tempted to switch to SFML though |
15:48:43 | Yardanico | yeah csfml is kinda nice |
15:48:51 | Yardanico | and there's a nim wrapper for it :P |
15:49:05 | shashlick | dom96: no I was asking about getting choosenim update self to work, and the init script |
15:49:12 | Yardanico | https://github.com/oprypin/nim-csfml |
15:49:15 | shashlick | They still only install 0.4.0 |
15:49:20 | Yardanico | "This library consists of class wrappers implemented as ptr object. Because Nim does not allow attaching pointers to the garbage collector, disposal of objects is not implemented and needs to be manual, by calling the destroy methods." right now this can be implemented I think |
15:49:28 | dom96 | shashlick, are you sure? I update the `stable` channel for choosenim |
15:50:07 | * | Guest52746 quit (Remote host closed the connection) |
15:50:15 | shashlick | Ok it wasn't last night so |
15:50:24 | dom96 | Yardanico, I used that package for https://github.com/dom96/ld40/ |
15:51:12 | dom96 | probably should have stuck to it since I managed to make some sort of game with it in 48 hours |
15:51:32 | dom96 | but sunk-cost and all that |
15:51:48 | dom96 | shashlick, updated today |
15:52:34 | dom96 | Yardanico, I'm also certain that SDL2 can be used with Nim and webasm, not sure about SFML on that |
15:52:53 | Yardanico | yeah, it seems there's no such support |
15:53:22 | FromGitter | <alehander92> madprops i actually agree with those people, the previous name is not good |
15:53:51 | Yardanico | The previous name was okay for me since I don't really knew or used "Nimrod" in its bad definition :P |
15:53:58 | Yardanico | didn't* |
15:55:26 | FromGitter | <alehander92> madprops interested where you saw that |
15:56:49 | FromDiscord | <Fern & Simula (They/Them)> is there a way to specify that an argument passed to a macro can't be a literal? |
15:57:17 | FromDiscord | <Generic> it can be if you use static |
15:57:31 | FromGitter | <alehander92> you can do a macro which takes a literal with static |
15:57:33 | FromDiscord | <Generic> e.g. macro blarg(x: static[int]): untyped = discard |
15:57:41 | FromGitter | <alehander92> and make it produce an error on compile time |
15:57:43 | FromDiscord | <Fern & Simula (They/Them)> ah, perfect. thanks! |
15:57:45 | FromGitter | <alehander92> and then! |
15:57:57 | FromGitter | <alehander92> make another overload which cant take a literal which will only work |
15:58:37 | FromGitter | <alehander92> Fern, Generic: notice you need this workaround if the wish is that it *can not* be a literal |
16:00:11 | FromDiscord | <Fern & Simula (They/Them)> yes, that's exactly what i want |
16:00:15 | FromDiscord | <Fern & Simula (They/Them)> thank you :) |
16:08:32 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
16:09:53 | disruptek | today we make cookies. |
16:09:57 | disruptek | what's a good cookie to make? |
16:16:37 | livcd_ | .erlang.cookie |
16:17:17 | disruptek | erlang gives me hives. |
16:17:58 | FromGitter | <matrixbot> `grantmwilliams` don't be jealous of Erlang Gang |
16:18:39 | FromGitter | <matrixbot> `grantmwilliams` Has anyone seen a good implementation of an AMQP library in Nim? I've only seen an implementatin of STOMP so far |
16:19:53 | disruptek | not aware of anything. |
16:19:56 | FromGitter | <bung87> there is zmq |
16:19:59 | * | icebattle joined #nim |
16:20:07 | disruptek | !repo mqtt |
16:20:08 | disbot | https://github.com/barnybug/nim-mqtt -- 9nim-mqtt: 11mqtt wrapper for nim 15 5โญ 1๐ด 7& 4 more... |
16:20:18 | FromDiscord | <mratsim> I can also play this game. As anyone seen a tensor libraries in Erlang? ๐ |
16:20:20 | disruptek | !repo zevv/nmqtt |
16:20:21 | disbot | https://github.com/zevv/nmqtt -- 9nmqtt: 11Native Nim MQTT client library 15 5โญ 0๐ด |
16:30:54 | FromDiscord | <Fern & Simula (They/Them)> i have a nimble package split up into multiple files. is there any way to get that to work in just one import statement? should i just use `include`? |
16:35:11 | * | endragor joined #nim |
16:35:34 | disruptek | you can use commas to separate multiple import targets. |
16:35:46 | * | Hideki joined #nim |
16:36:09 | * | Hideki is now known as Guest84791 |
16:36:17 | dom96 | gotta love that trailing comma being ignored https://play.nim-lang.org/#ix=24Wo |
16:36:34 | disruptek | feature. |
16:37:40 | madprops | weird echo |
16:38:14 | madprops | i always inline it, without parens |
16:38:47 | dom96 | It's a repro of a longer piece of code |
16:39:37 | dom96 | currently trying to work out why colors.`$` isn't called on my colour but instead the `system` one. |
16:40:44 | dom96 | ugh, so annoying to get stuck on such silly things |
16:42:17 | FromDiscord | <Fern & Simula (They/Them)> disruptek: i meant import one module (the "main" one if you will) and have the rest silently come along? |
16:42:37 | * | Guest84791 quit (Ping timeout: 268 seconds) |
16:46:48 | dom96 | Fern: in the main module use "export moduleA, moduleB" then import that module |
16:55:56 | FromGitter | <bung87> when wrap macos sdk, how to declare a proc return expected result type or a error number ? |
16:58:00 | FromGitter | <bung87> I realize other language wrap c not like the Nim way, clearly declare a type or proc coming from which header file. |
16:58:04 | disruptek | let your wrapping proc set a var argument. return an error code or zero. |
16:58:52 | FromGitter | <bung87> ` result type or a error number` |
16:59:13 | disruptek | the proc returns a type? |
16:59:19 | FromDiscord | <badassiel> I was wondering if anyone was working on a client sdk for nim? |
16:59:25 | FromGitter | <bung87> a type or number |
16:59:39 | disruptek | client sdk for what serv(er|ice)? |
16:59:50 | FromDiscord | <badassiel> *client matrix sdk |
16:59:53 | * | silvernode quit (Ping timeout: 268 seconds) |
17:00:01 | FromGitter | <bung87> https://developer.apple.com/documentation/iokit/1514741-ioiteratornext?language=occ |
17:00:20 | disruptek | shashlick knows things about matterbridge... wicked, wicked things. |
17:00:40 | FromGitter | <bung87> yeah,I knew him |
17:01:30 | FromDiscord | <badassiel> oh wow didn't know matterbridge existed |
17:01:34 | oz | disruptek: well matterbridge is wicked to start with. :) |
17:01:34 | disruptek | if you want to wrap that, just make a real iterator that only returns values. |
17:01:40 | FromGitter | <bung87> I know Nim has Option type not sure can be used in wrap |
17:01:50 | disruptek | it can, but to what end? |
17:02:02 | disruptek | iterators are a thing nim programmers like to use. |
17:03:15 | FromGitter | <bung87> I want things to be simple, this task mainly is reading document and source. not like I am programingโฆ.. |
17:04:11 | FromGitter | <bung87> almost 1k line during wrap this on macOS... |
17:04:22 | FromGitter | <matrixbot> `grantmwilliams` Are there any ETL libraries in Nim? |
17:06:03 | FromDiscord | <Fern & Simula (They/Them)> disruptek: thanks! |
17:06:06 | FromGitter | <bung87> there are several lib, tools |
17:06:30 | disruptek | what did i do? |
17:06:57 | FromGitter | <bung87> not aware of all in one ETL project. |
17:07:22 | disruptek | the whole concept of ETL is too vague, honestly. |
17:08:01 | FromGitter | <matrixbot> `grantmwilliams` Interesting. It looks like Nim has a great sql library in the std lib so seems like a nice language for etl |
17:09:23 | FromGitter | <matrixbot> `grantmwilliams` > <@gitter_fromirc:matrix.org> *<disruptek>* the whole concept of ETL is too vague, honestly. โ โ To me ETL libraries end up being a set of connections (with a generic way to create new conneciton types) and some way to pipe data between those connections |
17:09:40 | FromGitter | <bung87> I know there are ,xml,csv,docx libs |
17:11:02 | disruptek | i'm not aware of a framework like that. i've never even used something like that in another language. |
17:12:45 | disruptek | it does feel like AQMP but i think you'd be better-served by something simpler. |
17:13:01 | FromGitter | <matrixbot> `grantmwilliams` There are a number of different approaches to the problem. You could probably consider spark an ETL library (or maybe something like pandas in python), then you have apache airflow which is more cron based etl approach |
17:13:08 | FromGitter | <alehander92> disruptek ohh cookies |
17:14:55 | FromGitter | <matrixbot> `grantmwilliams` You might consider a stream based library an ETL one too. So I agree that its a very vague concept. |
17:15:50 | disruptek | it's just hard to imagine a glue-like product that seeps into all the specific cracks needed for application. |
17:16:13 | disruptek | usually, you end up needing to customize pretty extensively. |
17:17:04 | solitudesf | disruptek, is it really necessary for nimph to write hints of every nimble package i have installed every time i perform any operation with it? it is the compiler's output, but i think you should silence it. |
17:17:19 | salotz[m] | is this the new nim mascot? https://img.scryfall.com/cards/large/front/c/3/c3a2c39b-b302-4cc3-b507-e4fe00614036.jpg?1562157213 |
17:17:31 | disruptek | can i see the output? |
17:17:31 | FromGitter | <matrixbot> `grantmwilliams` I think my ideal solution would give you async backpressure pipelines between connections and you'd be responsible for making the connections yourself and getting data out of them (via query or whatever) |
17:17:45 | disruptek | solitudesf: compile nimph with -d:release and it will be quiet. |
17:17:56 | solitudesf | its compiled with -d:danger |
17:18:06 | disruptek | weird, lemme see. |
17:18:07 | solitudesf | `/home/solitude/.nimble/pkgs/nimes-0.1/nim.cfg(14, 178) Hint: line too long [LineTooLong]` here's sample. |
17:18:43 | disruptek | oh, that's from the compiler's parser? |
17:18:50 | disruptek | i should be able to toggle that hint off. |
17:18:57 | disruptek | what other hints are spamming you? |
17:19:06 | solitudesf | thats the only one |
17:19:39 | disruptek | i will figure that out, or you can try toggling it in config.nim. |
17:19:50 | disruptek | that's where i toggle hinting about conf reads... |
17:20:19 | * | akitoshi quit (Quit: Connection closed for inactivity) |
17:20:32 | disruptek | what does nim consider a "too long" line in a config file, and why? |
17:20:57 | solitudesf | im just gonna uninstall the package. is there a reason for nimph to relay these things to a user? |
17:21:19 | disruptek | it's not in nimph code. it's code imported from the compiler. |
17:21:40 | disruptek | i don't think users need to see it, but i cannot directly control side-effects of parsing. |
17:21:53 | solitudesf | nice |
17:22:08 | disruptek | i'm pretty sure we can just toggle the hint. |
17:22:30 | disruptek | eg. line 94. |
17:22:32 | solitudesf | well, i only see that because of `verbosity:2`, im pretty sure |
17:22:36 | disruptek | how is nimph working other than that? |
17:23:34 | solitudesf | no clue, i just ran it on bunch of my existing packages and didn't need to do anything. im gonna try using it with a new one. |
17:24:37 | * | jonafato quit (Quit: ZNC - http://znc.in) |
17:24:50 | solitudesf | im going to need a name for it. its a program that expands text snippets as you type by *monitoring your input and abusing clipboard*. i couldn't come up with anything other that String EXpander. |
17:24:51 | lqdev[m] | could someone look into this? it's preventing me from continuing my projects. https://github.com/nim-lang/Nim/issues/12942 |
17:24:51 | disruptek | nimph 0.5.7 should fix that spam. |
17:24:53 | disbot | โฅ Default procedure parameters are untyped ; snippet at 12https://play.nim-lang.org/#ix=24WF |
17:25:19 | disruptek | disbot: you're terrible. go back to school. |
17:25:20 | disbot | on it. ๐ |
17:26:59 | FromGitter | <matrixbot> `grantmwilliams` i think echo was an interesting choice |
17:27:06 | * | jonafato joined #nim |
17:27:21 | lqdev[m] | @grantmwilliams: why? |
17:27:59 | FromGitter | <matrixbot> `grantmwilliams` i just wouldnt expect many languages to choose echo over print or procedure over function |
17:28:05 | FromDiscord | <Milerius> Hello |
17:28:13 | FromGitter | <matrixbot> `grantmwilliams` i dont have any problems with it, but i do think its interesting |
17:28:17 | FromDiscord | <Milerius> Is it normal that the hash of 2 string that have the same content are different ? |
17:28:57 | disruptek | function is a thing; a side-effect-free procedure. |
17:29:04 | disruptek | keyword `func`. |
17:29:16 | Yardanico | FromDiscord: what do you mean by "hash"? |
17:29:40 | FromDiscord | <Milerius> I want to retrieve a unique id from a string in nim, this id should be the same if 2 string have the same word |
17:29:42 | disruptek | solitudesf: how does it abuse the clipboard? |
17:29:53 | FromDiscord | <Milerius> hash("foo") == hash("foo") |
17:30:06 | disruptek | milerius: sounds amazing. |
17:30:13 | FromGitter | <matrixbot> `grantmwilliams` i just think its interesting that the term procedure made it into the language |
17:30:36 | disruptek | what would you use, noting that `function` is taken by functions? |
17:31:14 | FromGitter | <matrixbot> `grantmwilliams` i mean you could have a pure keyword infront of function for ones without side effects |
17:31:31 | FromGitter | <matrixbot> `grantmwilliams` but i dont actually have a problem with proc being in the language. i just said it was interesting not bad in any way |
17:31:32 | solitudesf | disruptek, well, it just copies needed text into it and simulates ctrl-v or whatever. just dont know if there is a better way. and it will going to be X only. |
17:31:45 | Yardanico | !eval echo(hash("foo") == hash("foo")) |
17:31:47 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: undeclared identifier: 'hash' |
17:31:55 | disruptek | xclip-like, then? |
17:31:55 | FromGitter | <matrixbot> `grantmwilliams` rust's ownership model is interesting too |
17:31:59 | Yardanico | !eval import hashes; echo(hash("foo") == hash("foo")) |
17:32:02 | NimBot | true |
17:32:21 | FromDiscord | <Milerius> This is not working for me |
17:32:33 | Yardanico | !eval import hashes; echo(hash("foo") == hash("foo")) |
17:32:35 | NimBot | true |
17:32:39 | Yardanico | hm |
17:32:50 | FromDiscord | <Milerius> can i show my example ? |
17:33:10 | disruptek | if you use a pastebin. ๐ |
17:33:12 | solitudesf | disruptek, it should be like this thing https://github.com/federico-terzi/espanso but not filled with useless garbage, and not dropping to cpp for half the code. |
17:33:44 | disruptek | cool. |
17:33:57 | disruptek | what do you need to do? |
17:34:41 | solitudesf | i need to write it |
17:34:58 | disruptek | to make it work on wayland. ๐ |
17:35:38 | solitudesf | is it possible on wayland? its basically a keylogger |
17:35:43 | FromDiscord | <Milerius> ok hash work, my problem come from some thing else |
17:35:51 | disruptek | well, xclip works, somehow. |
17:35:58 | disruptek | i'm using it in my ix paster. |
17:36:08 | federico3 | if you give it permissions... |
17:37:14 | disruptek | solitude don't take no shit. i like that. |
17:37:38 | disruptek | we need more unsatisfied users. |
17:38:12 | FromDiscord | <Milerius> But i have a serious problem understanding what is appening here: https://gist.github.com/Milerius/f12cbd83e727ec788383d7198644b13f |
17:38:30 | disruptek | you uploaded some code to a github gist. |
17:39:12 | FromDiscord | <Milerius> yep |
17:39:50 | disruptek | i do believe that RICK is the tickler. |
17:40:00 | disruptek | at least, it felt like RICK. |
17:40:41 | FromDiscord | <Milerius> Yeah... |
17:40:43 | FromDiscord | <Milerius> hash is the same |
17:40:48 | FromDiscord | <Milerius> string are equal |
17:40:51 | FromDiscord | <Milerius> len is the same |
17:41:03 | FromDiscord | <Milerius> but when use key it's working, when using ticker is crashing |
17:41:05 | FromDiscord | <Milerius> ๐คท |
17:42:39 | * | tane quit (Quit: Leaving) |
17:43:03 | disruptek | cm_at has a side-effect? |
17:43:12 | FromDiscord | <Milerius> const |
17:43:22 | Yardanico | where is is_ticker_present defined? |
17:43:33 | FromDiscord | <Milerius> I updated the gist |
17:44:33 | * | Trustable quit (Quit: Leaving) |
17:46:19 | disruptek | i'm assuming that it only crashes when you uncomment the earlier cm_at call against ticker. |
17:46:31 | FromDiscord | <Milerius> nop |
17:46:33 | FromDiscord | <Milerius> even in the loop |
17:46:35 | disruptek | is that wrong? are you changing the second call? |
17:46:37 | FromDiscord | <Milerius> i replace key by ticker |
17:46:42 | FromDiscord | <Milerius> it's not working |
17:46:45 | FromDiscord | <Milerius> in the loop |
17:46:56 | disruptek | what if you compose a new instance of a string? |
17:47:23 | disruptek | i'm thinking that it's the magical cstring semantics. |
17:48:09 | FromDiscord | <Milerius> ok if i use an int as key |
17:48:11 | FromDiscord | <Milerius> it's working |
17:48:13 | FromDiscord | <Milerius> instead of string |
17:48:17 | disruptek | ie. $typeof(key) == "cstring" |
17:48:17 | FromDiscord | <Milerius> i use the hash |
17:49:00 | FromDiscord | <Milerius> Yeah key is a cstring |
17:49:02 | disruptek | let cticker: cstring = ticker ... cm_at(cticker) |
17:49:27 | FromDiscord | <Milerius> i'm checking |
17:49:37 | disruptek | I NEED ANSWERS NOW |
17:49:45 | FromDiscord | <Milerius> second |
17:49:46 | disruptek | omg cookies. we forgot cookies. |
17:50:38 | * | Hideki joined #nim |
17:50:56 | FromDiscord | <Milerius> crashing with cticker |
17:50:58 | FromDiscord | <Milerius> @disruptek |
17:51:02 | * | Hideki is now known as Guest39222 |
17:51:34 | disruptek | curiouser and curiouser. |
17:54:07 | disruptek | so the problem here is that your indexer, at(), isn't able to match keys in the hash/ass-array/dict/map. |
17:54:38 | disruptek | why not modify that code to see what input it's receiving? |
17:54:57 | FromDiscord | <Milerius> idk, this class work for sure in C++ i'm using it with strings |
17:54:59 | FromDiscord | <Milerius> i never get problems |
17:55:03 | FromDiscord | <Milerius> i'm switching to nim now |
17:55:10 | FromDiscord | <Milerius> May be it's my fault, probably |
17:55:17 | FromDiscord | <Milerius> but i cannot understand where is my prob |
17:55:24 | FromDiscord | <Milerius> anyway i will move forward with integer as key for now |
17:55:50 | disruptek | well, this will bite you again until we understand it. |
17:55:58 | * | Guest39222 quit (Ping timeout: 260 seconds) |
17:56:17 | disruptek | you can look at the code nim generates by investigating the nimcache. |
17:56:23 | FromDiscord | <Milerius> Yup, but i have deadlines for work, so i will move forward and take more time on it latter |
17:57:17 | FromDiscord | <Milerius> PMunch are you around? |
17:57:43 | disruptek | i think your cm_at() is not comparing strings but is instead comparing pointer values. hence key works because it came right out of the map. |
17:58:04 | disruptek | i'm just guessing as to how it's implemented, though. |
17:58:10 | FromGitter | <alehander92> but let cticker: cstring = ticker |
17:58:14 | FromGitter | <alehander92> isnt really what you want |
17:58:30 | disruptek | no, it's irrelevant. i was just curious. |
17:58:44 | FromGitter | <alehander92> you want to convert the nim string to c string, and iirc the nim c string starts on ->data |
17:58:50 | FromGitter | <alehander92> which is not the first field |
17:58:54 | FromGitter | <Willyboar> Hello guys |
17:59:07 | disruptek | it doesn't matter; nim converts it all for us. |
17:59:33 | disruptek | hello mr. boar. |
17:59:48 | FromGitter | <alehander92> does it?? |
17:59:50 | FromGitter | <Willyboar> hello dis |
17:59:52 | FromGitter | <alehander92> ticker.cstring does |
18:00:00 | FromGitter | <alehander92> but maybe the let thing does also |
18:01:04 | disruptek | yeah, i was thinking maybe it was due to the ephemeral key var but now i'm pretty sure it's just a simple error in cm_at. |
18:01:33 | disruptek | occam's razor. |
18:02:31 | FromDiscord | <Milerius> yeah but my cm_at is just importing the C++ function |
18:02:32 | FromDiscord | <Milerius> as it |
18:02:49 | disruptek | yes, bugs exist in c++, too. |
18:02:51 | disruptek | it is known. |
18:03:08 | FromDiscord | <Milerius> probably |
18:03:46 | disruptek | so. cookies. |
18:03:52 | disruptek | i'm thinking molasses. |
18:08:24 | * | opi joined #nim |
18:10:40 | FromDiscord | <Milerius> I'm missing PMunch so much my guardian :p |
18:11:16 | * | qwertfisch quit (Quit: ZNC - http://znc.in) |
18:11:22 | opi | hi, I'm trying to build Nim out of source on RPi, it was working before, but now invoking build.sh throws an error, any hints? |
18:11:23 | opi | typedef int Nim_and_C_compiler_disagree_on_target_architecture[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1]; |
18:12:24 | Yardanico | that tells you what's the problem |
18:14:23 | opi | Yardanico: I understand what the problem is, but I don't really know how to solve it, otherwise I wouldn't ask. I have limited knowledge about compiler internals |
18:14:45 | Yardanico | well, what exactly are you running? |
18:14:48 | Yardanico | sh build_all.sh ? |
18:15:22 | opi | I did both cd csources && sh build.sh and build_all up top |
18:15:35 | opi | the kernel is 32 bit but the target says 64 |
18:15:54 | Yardanico | well, you don't need to do that manually |
18:16:03 | Yardanico | just clone the nim repo, cd into it and run `sh build_all.sh` |
18:16:12 | FromGitter | <alehander92> Araq |
18:16:25 | Yardanico | opi: maybe your C compiler is 64-bit for some reason? |
18:16:32 | FromGitter | <alehander92> lets have `smellonly` variables, @Willyboar gave me a great idea to model food |
18:16:39 | FromGitter | <alehander92> sorry, vacation mood already |
18:17:03 | opi | Yardanico: that's a possibility, I've been tinkering around on that system without paying much attention |
18:17:53 | FromDiscord | <mratsim> if there is an mismatch between the compiler and the kernel you need to pass ucpu=aarch64 or ucpu=armv7 it's an environment variable |
18:18:17 | FromDiscord | <mratsim> for example this is my build for building 32-bit nim on 64-bit: https://github.com/mratsim/weave/blob/master/azure-pipelines.yml#L43 |
18:18:26 | FromDiscord | <mratsim> I get arch mismatch otherwise |
18:20:58 | opi | thank you mratsim, I'm going to look into it |
18:23:16 | opi | yeah, I see the lines that overwrite the CPU in build.sh, that may be it |
18:23:19 | * | krux02 quit (Remote host closed the connection) |
18:24:38 | opi | ./build.sh --cpu armv7 worked for me, thanks! |
18:57:21 | * | MarquisdeFalbala joined #nim |
19:00:51 | * | luis_ joined #nim |
19:01:28 | shashlick | Some new nimterop cli features cooking: --output to to file, --prefix --suffix to strip symbols without cPlugin, --check to Nim check the generated wrapper, and --stub to stub out undeclared identifier errors as objects automatically |
19:01:45 | * | NimBot joined #nim |
19:03:05 | * | luis_ quit (Client Quit) |
19:03:30 | disruptek | how does stub work? |
19:04:00 | disruptek | i mean, will that fix my nimsuggest? |
19:11:15 | shashlick | Nope that's still on the backlog |
19:11:58 | shashlick | If certain symbols are not in the header or nimterop can stub them for you |
19:12:18 | shashlick | Assuming you don't really need them for your use case |
19:12:36 | disruptek | oh, i see. |
19:13:11 | disruptek | so this would let us pull the nimterop requirement out of nimgit, right? |
19:13:35 | disruptek | assuming we lock it to a particular version, etc. |
19:15:56 | * | icebattle quit (Ping timeout: 265 seconds) |
19:18:21 | shashlick | The cimport stuff maybe, depending on what all needs done |
19:18:29 | shashlick | But not the getHeader stuff though |
19:19:04 | shashlick | You are asking about https://github.com/nimterop/nimterop/issues/125 |
19:19:06 | disbot | โฅ Provide stand-alone operation |
19:19:57 | disruptek | right. |
19:20:44 | disruptek | when we add staticCurrentDir we'll be able to simplify some of this. |
19:20:57 | disruptek | ie. we can make relativePath work. |
19:22:14 | disruptek | leorize: this would be pretty cool for nim.nvim: https://github.com/ryanluker/vscode-coverage-gutters |
19:23:15 | lqdev[m] | why do tests fail on `--gc:orc`? I just forked and cloned |
19:23:43 | disruptek | it's not yet christmas. |
19:23:46 | Yardanico | arc* :P |
19:23:52 | lqdev[m] | orc. |
19:24:00 | lqdev[m] | I can read logs, mate. |
19:24:05 | Yardanico | xd |
19:24:29 | lqdev[m] | iirc orc was a variation of arc, but I can't really remember what's the difference |
19:26:10 | disruptek | one doesn't work, and the other one is broken. |
19:26:56 | shashlick | disruptek: I don't think we will get there with nimterop |
19:27:05 | disruptek | whaaa |
19:27:15 | disruptek | why not? |
19:27:20 | shashlick | Unlike c2nim which is a dev tool, nimterop is used at build time on the target system |
19:27:46 | disruptek | hmm, fair point. |
19:27:52 | shashlick | So the wrappers you generate are specific to the build system since preprocessor is already run |
19:28:10 | shashlick | I don't see how we can resolve this with this model |
19:28:15 | disruptek | we obviously need another layer of wrappers. |
19:28:31 | disruptek | introducing nimteropterop. |
19:28:51 | shashlick | I don't see the value in managing the cross platform stuff typically done in preprocessor |
19:28:58 | shashlick | Hard enough dealing with C |
19:29:02 | FromDiscord | <mratsim> I think I'll rename one of my library Urukh-Hai to go along gc:orc |
19:29:21 | shashlick | Maybe some day |
19:29:41 | shashlick | I'd rather spend time improving what we have and get to c++ |
19:29:45 | shashlick | Open to feedback though |
19:30:18 | FromDiscord | <mratsim> maybe read this: https://github.com/status-im/nim-beacon-chain/issues/640 |
19:30:19 | disbot | โฅ [RFC] producing more robust wrappers for external C libraries |
19:31:44 | * | opi quit (Quit: WeeChat 1.6) |
19:31:58 | * | clyybber joined #nim |
19:33:37 | shashlick | Will do |
19:36:02 | * | ofelas joined #nim |
19:38:28 | clyybber | Araq: We can apply this advanced form of static analysis to B/D though, and thats the great thing. |
19:38:41 | clyybber | It is essentially automatically inserting unown |
19:38:52 | clyybber | and *own* into the right places |
19:38:53 | FromDiscord | <mratsim> somehow I read can apply as crappy |
19:39:54 | FromGitter | <bung87> @shashlick what do you think about rust and go have libc wrap? |
19:41:26 | Araq | clyybber: probably |
19:42:26 | shashlick | bung87: will have to research, sori no idea |
19:44:54 | FromGitter | <bung87> ok |
19:47:14 | clyybber | Araq: This could be big, as evident from your wrong prepend proc :p |
19:47:23 | clyybber | s/prepend/append |
19:47:59 | * | rockcavera joined #nim |
19:48:49 | disruptek | i can emit (key: key, val: value) from a pairs() iterator but only (key, value) from an mpairs(). |
19:49:08 | clyybber | hmm |
19:49:14 | clyybber | report it |
19:53:24 | * | Hideki_ joined #nim |
19:58:55 | * | Hideki_ quit (Ping timeout: 265 seconds) |
20:00:33 | * | leorize quit (Remote host closed the connection) |
20:01:03 | * | leorize joined #nim |
20:07:28 | disruptek | http://ix.io/24XB |
20:16:52 | clyybber | disbot: You sleepin? |
20:17:07 | clyybber | or is he smart now? |
20:18:53 | shashlick | @mratsim: so he wants to have access to preprocessor macros? |
20:19:25 | shashlick | i do get that info in nimterop, could be converted into templates but the RHS is not trivial since you just get a blob of code which needs to nimmized |
20:21:24 | * | endragor quit (Remote host closed the connection) |
20:23:53 | disruptek | disbot doesn't share ix links anymore because pmunch. |
20:24:19 | FromGitter | <Willyboar> ??? |
20:26:08 | * | MightyJoe quit (Ping timeout: 245 seconds) |
20:26:25 | * | cyraxjoe joined #nim |
20:30:36 | FromDiscord | <Milerius> imariscal in in the chat ? |
20:38:35 | FromGitter | <zetashift> you mean @lmariscal? |
20:41:24 | * | exelotl joined #nim |
20:44:59 | * | pbb quit (Ping timeout: 246 seconds) |
20:46:54 | * | pbb joined #nim |
20:46:54 | FromDiscord | <mratsim> we want to minimize manual intervention in crazy wrappers |
20:47:23 | disruptek | what fun would that be? |
20:49:11 | * | sagax quit (Ping timeout: 265 seconds) |
20:49:22 | shashlick | that's exactly what i care about |
20:49:29 | shashlick | i don't like anything manual as much as possible |
20:50:04 | shashlick | am replying to that thread, but meanwhile, will also run through ncurses and libbacktrace and see what a nimterop wrapper will look like |
20:54:06 | * | sagax joined #nim |
20:54:22 | clyybber | disruptek: Oh, why? |
20:54:40 | disruptek | he felt it was spammy. |
20:55:20 | disruptek | i guess he pastes a lot of non-nim stuff to the channel and it was uselessly posting playground links for it. |
20:55:44 | * | endragor joined #nim |
20:59:17 | clyybber | :9 |
20:59:19 | clyybber | :( |
21:00:39 | * | endragor quit (Ping timeout: 258 seconds) |
21:05:14 | * | qwertfisch joined #nim |
21:10:02 | disruptek | `nimph graph` can now dump releases and version-changing commits: https://github.com/disruptek/nimph#graph |
21:17:53 | * | pbb quit (Ping timeout: 246 seconds) |
21:20:50 | * | pbb joined #nim |
21:28:33 | lqdev[m] | can anyone help me with a workaround for this? https://github.com/nim-lang/Nim/issues/12942 |
21:28:34 | disbot | โฅ Default procedure parameters are untyped ; snippet at 12https://play.nim-lang.org/#ix=24WF |
21:28:54 | lqdev[m] | I've been struggling at this for hours now, and I'm simply unable to come up with something reliable. |
21:31:26 | disruptek | can you get the type of the later occurence of thing? |
21:32:24 | disruptek | just discard it so you can fetch the type and then literally discard your discard statement if you wanna be anal. |
21:32:54 | * | MarquisdeFalbala quit (Remote host closed the connection) |
21:36:03 | lqdev[m] | disruptek: not really, because `thing` could be defined in a different module, at least afaict. |
21:36:21 | disruptek | why does that matter? |
21:36:53 | disruptek | 1) have a macro put discards in for every param. |
21:37:03 | disruptek | 2) have a macro read those discards to get the types. |
21:37:06 | disruptek | 3) profit! |
21:37:39 | lqdev[m] | it's not related to `discard`s, take a look at the output I provided in the issue |
21:38:01 | lqdev[m] | the fact that the default parameter is untyped makes it impossible for me to get its type |
21:38:05 | disruptek | i did. i noticed that you have sym for thing in the discard statement. |
21:38:06 | FromDiscord | <Fern & Simula (They/Them)> is there a way for a macro to traverse a nested data structure? |
21:38:42 | disruptek | fern: sure. |
21:38:59 | disruptek | fern: the ast is one such data structure. |
21:39:40 | FromDiscord | <Fern & Simula (They/Them)> hmmm, trying to figure out how to word this properly |
21:39:55 | lqdev[m] | disruptek: the thing is, once I get to that parameter, I can't really add another semantic pass without introducing large amounts of complexity into my lib |
21:40:42 | FromDiscord | <Fern & Simula (They/Them)> nvm, it was getTypeImpl i was looking for |
21:40:57 | FromDiscord | <Fern & Simula (They/Them)> oh crap, that requires a typed param and i can't do those |
21:41:20 | * | solitudesf- joined #nim |
21:41:36 | Yardanico | an untyped param can't have a type because it's not semchecked by the compiler yet (IIRC) |
21:41:39 | lqdev[m] | fern: defer that to another macro that you `newCall(bindSym"someMacroThatAcceptsTyped")` |
21:41:52 | * | solitudesf quit (Ping timeout: 265 seconds) |
21:42:27 | FromDiscord | <Fern & Simula (They/Them)> what does `newCall` do? |
21:43:09 | lqdev[m] | fern: it creates a new call node to the procedure in the first parameter, passing arguments from the rest of the parameters. |
21:43:23 | lqdev[m] | disruptek: take a look at https://github.com/liquid600pgm/euwren/blob/master/src/euwren.nim#L482 |
21:43:54 | * | solitudesf joined #nim |
21:44:08 | lqdev[m] | this is where the default parameter causes a problem |
21:44:30 | FromDiscord | <Fern & Simula (They/Them)> lqdev[m]: so does that `newCall(bindSym...)` add type information for an untyped macro? |
21:44:47 | * | endragor joined #nim |
21:44:48 | lqdev[m] | fern: no, it just generates a call like `someProc(a, b, c, โฆ)` |
21:44:56 | * | livcd_ quit (Quit: Lost terminal) |
21:45:03 | disruptek | i would rewrite it in a lower macro. |
21:45:25 | lqdev[m] | fern: you can output that from your `untyped` macro, and the call can contain the parameters you need as `typed` |
21:45:33 | disruptek | yay, nimph doesn't work with cpp. |
21:45:37 | FromDiscord | <Fern & Simula (They/Them)> not sure that would help me. i think i'll just rewrite the macro as typed and use discard statements |
21:46:13 | * | solitudesf- quit (Ping timeout: 265 seconds) |
21:47:10 | lqdev[m] | disruptek: what do you mean, "lower macro"? |
21:47:35 | disruptek | a macro that rewrites the ast prior to L482 in euwren.nim. |
21:48:39 | lqdev[m] | maybe I could implement `getParamList` itself as a macro, and call it somewhere inbetween, or something |
21:48:43 | lqdev[m] | I don't know |
21:49:36 | * | endragor quit (Ping timeout: 265 seconds) |
21:53:26 | disruptek | that's the idea. |
21:53:51 | disruptek | you have something else consume the proc and annotate it with discards that'll get sym'd for later. |
21:55:31 | lqdev[m] | it doesn't really have to be annotated with discards and stuff, just do anything that'll cause these poor untyped values to get semchecked |
21:55:38 | disruptek | yes. |
21:55:46 | * | Hideki joined #nim |
21:56:10 | * | Hideki is now known as Guest12527 |
22:02:42 | lqdev[m] | guess something like this https://play.nim-lang.org/#ix=24Yf |
22:03:09 | lqdev[m] | too bad I can't use tuples here, would make for much cleaner code |
22:04:42 | disruptek | i was thinking addProcAux would just rewrite the proc with a discard as the first line of the body. then anything that operates on it can just read that line to determine types. |
22:04:54 | disruptek | that's what i meant by annotation. |
22:05:38 | * | Guest12527 quit (Ping timeout: 260 seconds) |
22:06:05 | shashlick | that took longer than I hoped, but was fun nonetheless - https://github.com/status-im/nim-beacon-chain/issues/640#issuecomment-568105020 |
22:06:05 | disbot | โฅ [RFC] producing more robust wrappers for external C libraries |
22:06:46 | shashlick | ended up making libbacktrace and libncurses wrappers |
22:06:50 | * | rockcavera quit (Remote host closed the connection) |
22:07:10 | shashlick | @mratsim - hope it is valuable to your team |
22:07:19 | * | gangstacat quit (Quit: ฤis!) |
22:09:01 | disruptek | shashlick, you are bringing to reality the as-yet merely promised potential of nim. |
22:10:11 | disruptek | the pragmatic point is, if it's too burdensome to create wrappers, it doesn't matter how good the ffi is. |
22:10:34 | * | nsf quit (Quit: WeeChat 2.6) |
22:16:13 | shashlick | yep and i'm still at the `create wrappers` step, there's still the part of making it easy to use the wrappers |
22:16:52 | shashlick | raw C wrappers aren't all that nice |
22:16:56 | disruptek | so much potential. |
22:17:59 | disruptek | so nimph doesn't work with cpp. |
22:19:57 | disruptek | something related to mutable iteration, i think. |
22:21:10 | * | sagax quit (Ping timeout: 268 seconds) |
22:30:04 | dom96 | I'm personally still of the opinion that we can get an awesome experience by creating a macro which generates wrappers at compile-time using libclang |
22:31:46 | disruptek | nimterop will be able to generate wrappers for myriad languages, though, and without the weight of clang. |
22:34:51 | shashlick | dom96 - nimterop is exactly you statement with s/libclang/tree-sitter/ |
22:38:48 | dom96 | it generates wrappers at nimble install-time though, not compile-time, right? |
22:39:29 | FromDiscord | <mratsim> @clyyber, I finally solved my Glibc bug, and I confirm it's Glibc which has a flaky condition variable implementation |
22:40:05 | disruptek | dom96: nimterop works at project compile-time, just the way you'd expect. |
22:40:10 | FromDiscord | <mratsim> I remimplemented condvar from scratch ๐ |
22:40:45 | * | sealmove quit (Quit: WeeChat 2.6) |
22:48:09 | clyybber | mratsim: Damn, good job. I'll have to take a look |
22:48:26 | FromDiscord | <mratsim> it's short: https://github.com/mratsim/weave/pull/58/files |
22:48:27 | disbot | โฅ Me 1 - 0 Glibc: replace buggy Glibc condvar by futex |
22:48:34 | Yardanico | did you report it? |
22:48:39 | Yardanico | just curious to see the devs responses |
22:48:42 | FromDiscord | <mratsim> nop |
22:48:59 | FromDiscord | <mratsim> I don't want to deal with their bug tracker from the 2000s |
22:49:40 | FromDiscord | <mratsim> + reproducing a C test case would be too time-consuming |
22:49:46 | FromDiscord | <mratsim> creating a C test case* |
22:50:01 | clyybber | mratsim: Wait, and it made it faster? Or at least more mem efficient? |
22:51:00 | FromDiscord | <mratsim> obviously |
22:51:09 | FromDiscord | <mratsim> everything in pthread is based on futex |
22:51:16 | FromDiscord | <mratsim> mutex, condvar, semaphore |
22:51:27 | FromDiscord | <mratsim> at a low-level it's the unique way to put a thread to sleep |
22:51:36 | shashlick | dom96: you are thinking of nimgen |
22:51:40 | FromDiscord | <mratsim> condvar with timeout, lock with timeout |
22:51:52 | FromDiscord | <mratsim> so it's also faster |
22:52:08 | clyybber | Well thats just fucking nice :D |
22:52:26 | FromDiscord | <mratsim> benefits of formal verification ๐ |
22:52:39 | FromDiscord | <mratsim> I know that naked wait + wake are enough |
22:53:08 | clyybber | Why is it only enabled on linux though? |
22:53:09 | FromDiscord | <mratsim> locks and condvars have a lots of if/else/if/else to avoid race conditions and misuses |
22:53:20 | FromDiscord | <mratsim> Only Linux and Windows have futex |
22:53:23 | dom96 | shashlick, oh, I see. that's awesome. |
22:53:28 | FromDiscord | <mratsim> MacOS and BSD don't have them |
22:53:35 | clyybber | Thats a shame |
22:53:43 | clyybber | well, at least they don't have that bug |
22:53:48 | shashlick | Nimarchive used in choosenim is a nimterop based wrapper |
22:54:04 | FromDiscord | <mratsim> here is an intro: https://eli.thegreenplace.net/2018/basics-of-futexes/ |
22:54:26 | * | gour_ joined #nim |
22:54:26 | dom96 | shashlick, how mature is it? What are the chances it will just work (TM) if I throw any header file at it? |
22:56:17 | dom96 | also, does it support C/C++/ObjC equally well? |
22:57:06 | clyybber | mratsim: Hmm, I'm pretty sure BSD has futex |
22:57:22 | clyybber | at least OpenBSD, and then probably Free and Dragonfly too |
22:57:57 | * | gour quit (Ping timeout: 258 seconds) |
23:00:14 | FromDiscord | <mratsim> seems like it's from 2016 |
23:05:14 | * | pbb quit (Read error: Connection reset by peer) |
23:06:32 | * | pbb joined #nim |
23:07:46 | FromDiscord | <niv> dom96: hi! can i do await sleepAsync(0) as a valid "yield to scheduler" thing? |
23:07:55 | * | solitudesf quit (Ping timeout: 258 seconds) |
23:08:22 | dom96 | niv: sure. that will work, but what is your use case? |
23:08:26 | FromDiscord | <mratsim> you can do cpuRelax() if you compile with threads:on |
23:09:06 | FromDiscord | <niv> im calling into a C lib in a while loop, so i need to yield once in a while to allow other fibers to run |
23:09:38 | FromDiscord | <niv> while true: { mydata = recv(timeout=5); handle(myadata); await sleepAsync(0) } |
23:09:59 | FromDiscord | <mratsim> oh, don't use cpuRelax then ๐ |
23:10:01 | shashlick | dom96: it only supports C, and restricts to header files only, no implementation |
23:10:03 | FromDiscord | <niv> yeah! |
23:10:07 | dom96 | yes, that will work, but it's not ideal: it'll busy loop your CPU |
23:10:24 | FromDiscord | <niv> no, it wont. the recv call sleeps on a cv/lock until the timeout has passed |
23:10:29 | FromDiscord | <niv> so sleepAsync gets called every 5ms |
23:10:39 | shashlick | dom96: it works well enough since it only wraps what it recognizes |
23:10:51 | shashlick | dom96: so you don't error out |
23:10:53 | dom96 | niv: isn't `recv` awaited? |
23:10:57 | FromDiscord | <niv> seems to work fine in testing. can i do sleepAsync(0) or is there something that will short-circuit it on some platforms to "do nothing"? |
23:11:16 | FromDiscord | <niv> dom: its not actually recv, its a custom function that's just named like that but doesnt use sockets underneath |
23:11:35 | FromDiscord | <niv> its a wrapper around openssl DTLS. its somewhat hairy. |
23:11:55 | FromDiscord | <niv> i wouldnt mind making it async itself, but i havent had a chance to really dig into what would be needed to do that on the C side |
23:12:54 | dom96 | sleepAsync(0) shouldn't be short circuited, but you might wish to use `1` instead to be certain |
23:13:09 | dom96 | for future proofing :) |
23:13:20 | FromDiscord | <niv> ok! thanks. |
23:13:33 | FromDiscord | <niv> how do i make something awaitable from the C side? where can i start looking? |
23:14:43 | dom96 | https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L1339-L1367 |
23:15:12 | FromDiscord | <niv> ok, i guess i can do that. thanks. it's been a very long day so far |
23:15:25 | dom96 | it could be tough depending on what you're doing |
23:15:55 | FromDiscord | <niv> the mentioned recv call just blocks on a condition_var until a queue can cough up one or more packets, then it returns them |
23:16:07 | dom96 | the basic approach is: register an FD with the underlying selector, call `addRead`/`addWrite` to get a callback when the FD is readable/writeable, wrap that in a proc which handles the callback and completes the future appropriately |
23:16:20 | FromDiscord | <niv> i dont get access to the fd unfortunately. i'd have to fake it |
23:16:36 | FromDiscord | <niv> DTLS abstracts all of that pretty much away, best i can tell |
23:16:46 | dom96 | you might be able to use the condition var, it's possible that epoll/kqueue gives readiness info for it |
23:17:19 | FromDiscord | <niv> i'll look into it next year. for now, this should be enough not to suck too badly perf wise |
23:17:38 | dom96 | sure |
23:18:40 | FromDiscord | <niv> i am excited to see how well this will perform :) |
23:20:13 | FromDiscord | <niv> are you on discord perchance, where i could brazenly PM you? |
23:20:47 | dom96 | yeah, I'm there but don't open it very often |
23:21:03 | FromDiscord | <niv> i'll tell you a bit about what this is for, you might get a kick out of it |
23:21:26 | * | pbb quit (Ping timeout: 246 seconds) |
23:34:46 | * | Vladar quit (Remote host closed the connection) |
23:36:55 | * | hexeratops joined #nim |
23:40:49 | * | gangstacat joined #nim |