00:00:02 | * | junland quit (Quit: %ZNC Disconnected%) |
00:00:42 | * | junland joined #nim |
00:01:03 | FromDiscord | <KingDarBoja> By cut off the larger container, you mean it was splitting the string? |
00:02:24 | leorize | it means zip("123456", [1, 2, 3]) -> @[("1", 1), ("2", 2), ("3", 3)] |
00:03:45 | FromDiscord | <KingDarBoja> Oh okay, gotcha |
00:04:03 | krux02 | so zip on two strings should not create strings, it should create characters |
00:05:43 | FromDiscord | <KingDarBoja> https://docs.python.org/3/library/functions.html#zip yeah it is at the Python example |
00:06:49 | FromDiscord | <KingDarBoja> But pretty clever fix if you ask me |
00:06:58 | FromDiscord | <KingDarBoja> Didn't expected the x != y comparison was the issue |
00:07:16 | FromDiscord | <KingDarBoja> Due to zip not creating characters |
00:07:17 | leorize | that's not the only issue :) |
00:07:31 | leorize | also it wasn't creating characters because you didn't use it correctly |
00:07:59 | leorize | !eval zip("abcd", "1234") |
00:08:01 | NimBot | Compile failed: /usercode/in.nim(1, 1) Error: undeclared identifier: 'zip' |
00:08:03 | leorize | !eval echo zip("abcd", "1234") |
00:08:05 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: undeclared identifier: 'zip' |
00:08:13 | leorize | !eval import sequtils; echo zip("abcd", "1234") |
00:08:16 | NimBot | @[('a', '1'), ('b', '2'), ('c', '3'), ('d', '4')] |
00:08:27 | leorize | ^ characters |
00:08:38 | leorize | another issue is that you weren't using a raw string |
00:08:56 | FromDiscord | <__ibrahim__> hi, what is the equivalent of: |
00:08:56 | FromDiscord | <__ibrahim__> (void*)0 |
00:08:56 | FromDiscord | <__ibrahim__> in nim? |
00:08:59 | leorize | so `\t` and `\n` turns into literal tabs and newlines instead :) |
00:09:05 | leorize | __ibrahim__ nil |
00:09:13 | FromDiscord | <__ibrahim__> ok thanks |
00:10:00 | FromDiscord | <KingDarBoja> Where it was? I didn't saw it |
00:10:02 | FromDiscord | <KingDarBoja> π |
00:11:22 | leorize[m] | line 6 and 7 in your version |
00:11:41 | leorize[m] | you can see that in line 3 and 4, the python code was passing raw strings |
00:12:09 | FromDiscord | <KingDarBoja> The regex? |
00:12:18 | leorize[m] | yep |
00:13:14 | FromDiscord | <KingDarBoja> Oh, the "r" |
00:14:06 | FromDiscord | <KingDarBoja> I definetively feel a bit confused due to how Nim split string in several definitions while Python is pretty much string for all (ofc for users) |
00:14:16 | FromDiscord | <KingDarBoja> That happens with unicode handling too |
00:14:50 | FromDiscord | <KingDarBoja> But Variount explained that to me (the char as data type and character) |
00:16:11 | FromDiscord | <KingDarBoja> How old have you been coding on Nim? just curious |
00:16:23 | * | opal quit (Ping timeout: 240 seconds) |
00:19:38 | * | opal joined #nim |
00:30:05 | FromDiscord | <KingDarBoja> Umm, just tested a special case, when it has `\t` character on the string |
00:30:06 | FromDiscord | <KingDarBoja> https://repl.it/repls/SoggyFabulousPhysics |
00:38:26 | Prestige | procs implicitly return values? Looking at https://nim-lang.org/docs/tut1.html#advanced-types-open-arrays |
00:38:50 | Prestige | seems openARraySize is returning oa.len, thought you'd have to assign it to result or explicitly return |
00:41:51 | * | dwdv quit (Ping timeout: 260 seconds) |
00:43:36 | FromDiscord | <Rika> Prestige: if every last statement matches the return type, that is returned |
00:44:03 | Prestige | Neat, thanks |
00:44:04 | FromDiscord | <Rika> every, since there can be multiple last statements |
00:44:22 | Prestige | I'll probably avoid doing that but it's good to know |
00:44:51 | FromDiscord | <KingDarBoja> I tend to use return instead of assigning to result unless it is a initMyType / newMyType proc π |
00:45:07 | FromDiscord | <KingDarBoja> And yes, I know return performs a call to result |
00:45:27 | FromDiscord | <Recruit_main707> Itβs a matter of preferences |
00:45:31 | FromDiscord | <Rika> ^ |
00:45:45 | FromDiscord | <Rika> i use last-statement and result more than return |
00:45:46 | Prestige | yeah, I think using `return x` is much more readable |
00:45:54 | Prestige | but all preference |
00:45:59 | FromDiscord | <Rika> i only use return when its control flow is needed |
00:46:07 | Prestige | was just confused cuz I didn't know about the implicit return |
00:46:09 | FromDiscord | <Recruit_main707> I use return specially when itβs one line long |
00:46:34 | FromDiscord | <Rika> i especially avoid return when its one line long |
00:46:35 | FromDiscord | <Recruit_main707> Or on specially long procs that donβt need result |
00:47:16 | FromDiscord | <KingDarBoja> String literals can also be delimited by three double quotes """ ... """. |
00:47:24 | * | FromDiscord <KingDarBoja> Literals in this form may run for several lines, may contain " and do not interpret any escape sequences. |
00:47:32 | FromDiscord | <KingDarBoja> Oh yikes! |
00:48:39 | FromDiscord | <KingDarBoja> So I can't put `\t` inside a string literals surrounded by triple double quotes |
00:52:20 | Prestige | I suppose you could just press tab on your keyboard? hm |
00:52:27 | Prestige | that is a bit odd though |
00:54:46 | FromDiscord | <KingDarBoja> Just comparing some Python vs Nim code |
00:55:02 | FromDiscord | <KingDarBoja> And noticed that while passing the `\t` inside triple string quotes |
00:55:04 | leorize | Nim has r"string" too btw |
00:55:43 | FromDiscord | <KingDarBoja> Yeah but that one do not interpret escape sequences |
00:55:56 | leorize | well choose one :P |
00:56:03 | leorize | !eval echo "\\t" |
00:56:05 | NimBot | \t |
00:56:08 | leorize | or you can compromise a bit |
00:56:45 | FromDiscord | <KingDarBoja> Did you ran the Python example with that? |
00:56:58 | leorize | ? |
00:57:10 | FromDiscord | <KingDarBoja> https://repl.it/repls/SoggyFabulousPhysics |
00:57:13 | FromDiscord | <KingDarBoja> This one |
00:57:23 | FromDiscord | <KingDarBoja> I changedt he string inside triple quotes |
00:58:37 | leorize | I still don't know what you mean :P |
00:58:59 | * | Tyresc quit (Quit: WeeChat 2.7-dev) |
00:59:37 | leorize[m] | <FromDiscord "<KingDarBoja> How old have you b"> been writing Nim for 3 years I think |
00:59:38 | FromDiscord | <Rika> nim: r"\t" will look like `\t` and not the actual character; same with """\t""" |
00:59:49 | leorize | echo """\t""" |
00:59:52 | leorize | !eval echo """\t""" |
00:59:53 | FromDiscord | <KingDarBoja> Yeah, what Rika said |
00:59:55 | NimBot | \t |
01:00:03 | leorize | ok sounds like a bug |
01:00:04 | FromDiscord | <Rika> @KingDarBoja wahts your aim then?? |
01:00:28 | FromDiscord | <KingDarBoja> Not a bug, the docs stated that triple quote strings doesn't excape characters |
01:00:51 | FromDiscord | <KingDarBoja> Which is different to how Python handles that, just noticed after testing both dedent implementations |
01:00:54 | FromDiscord | <KingDarBoja> escape* |
01:01:01 | leorize | ah, yea |
01:01:10 | FromDiscord | <KingDarBoja> So Nim one will crash xD |
01:01:24 | FromDiscord | <Rika> crash? |
01:01:25 | FromDiscord | <Rika> why so? |
01:02:23 | FromDiscord | <KingDarBoja> Oops, wrong word |
01:02:30 | FromDiscord | <KingDarBoja> I mean, not escape it π |
01:02:37 | leorize[m] | about result or return: I use result all the time, unless I can't |
01:02:46 | leorize[m] | return is kinda like `go to` |
01:02:50 | leorize[m] | `goto`* |
01:03:25 | FromDiscord | <Rika> @KingDarBoja you can still input the actual character, you just cannot use escape sequences im pretty sure |
01:04:14 | FromDiscord | <KingDarBoja> Yeah, by pressing the tab |
01:04:41 | FromDiscord | <KingDarBoja> Like, whoever tries to use it, will have to check the docs π |
01:04:59 | leorize[m] | luckily no one ever does :P |
01:05:54 | FromDiscord | <KingDarBoja> Well, not very experienced on graphql projects besides the ones I made at my job but maybe someone does that xD |
01:06:09 | FromDiscord | <KingDarBoja> Ofc speaking about Python |
01:07:17 | FromDiscord | <Rika> well, whoever knows nim is bound to know that """ """ is raw |
01:07:33 | leorize | I learned that just now lol |
01:07:36 | FromDiscord | <Rika> so they'd know \t isnt gonna be converted |
01:07:45 | FromDiscord | <Rika> leorize: ah well fuck |
01:08:42 | * | krux02 quit (Remote host closed the connection) |
01:08:45 | FromDiscord | <KingDarBoja> Plus ultra! |
01:09:23 | FromDiscord | <KingDarBoja> I just replace it by pressing the tab, xD |
01:10:11 | FromDiscord | <Rika> i dont use tabs anyway π |
01:10:19 | FromDiscord | <KingDarBoja> Tabs > spaces |
01:10:37 | FromDiscord | <Avatarfighter> imagine indenting ur code smh |
01:11:25 | leorize | tabs are evil |
01:11:57 | FromDiscord | <Avatarfighter> the strat is to set tabs to spaces of size 4 in your editor so you can say your using spaces even though your pressing tab lol |
01:12:16 | leorize | they create the illusion of "you can size it however you want" |
01:12:18 | FromDiscord | <KingDarBoja> LOOL |
01:12:25 | leorize | that never work out in practice |
01:12:34 | leorize | @Avatarfighter: the Nim standard is 2 spaces :P |
01:12:47 | FromDiscord | <KingDarBoja> Well, 1 tab = 2 spaces |
01:13:02 | FromDiscord | <KingDarBoja> You saving one extra button press |
01:13:05 | FromDiscord | <Avatarfighter> smh |
01:13:26 | leorize[m] | well I didn't save one extra button press |
01:13:31 | FromDiscord | <Avatarfighter> https://dsh.re/7bf3c guess im a rebel π |
01:13:36 | leorize[m] | I save my thumb :p |
01:13:59 | FromDiscord | <Rika> ah man here we go again w/ the tabs vs spaces argument |
01:14:02 | * | chemist69 quit (Ping timeout: 260 seconds) |
01:14:06 | FromDiscord | <Avatarfighter> naw im using spaces |
01:14:13 | leorize[m] | @Avatarfighter: don't worry it's kinda common too |
01:14:14 | FromDiscord | <Rika> i mean w/ boja and leo |
01:14:22 | FromDiscord | <Avatarfighter> ah lol |
01:15:34 | FromDiscord | <Avatarfighter> ugh why is it that whenever I need a specific algorithm its always explained in a written fashion but doesn't include pseudocode or examples of it |
01:15:54 | * | chemist69 joined #nim |
01:16:45 | FromDiscord | <Rika> its reading comprehension time |
01:16:57 | FromDiscord | <Avatarfighter> :GWaobloChildPepeSweat: |
01:20:00 | FromDiscord | <Avatarfighter> I needed the LEDBAT algorithm and it took me like an hour look for code that wasn't spaghetti haha |
01:22:55 | FromDiscord | <Avatarfighter> it also took a bit to find something that wasn't someones thesis |
01:26:18 | leorize[m] | sometimes you just gotta read the thesis :P |
01:28:32 | FromDiscord | <Avatarfighter> yeah sadly sometimes you must |
01:30:49 | * | Cthalupa quit (Ping timeout: 264 seconds) |
01:32:34 | * | lritter quit (Ping timeout: 265 seconds) |
01:32:52 | * | Cthalupa joined #nim |
01:33:11 | * | lritter joined #nim |
01:35:19 | FromDiscord | <KingDarBoja> Options > proc overload |
01:35:45 | FromGitter | <awr1> 2 spaces is good for nim |
01:36:14 | FromGitter | <awr1> Often DSLs/untyped macros will leave you with numerous indentation levels |
01:36:48 | FromGitter | <awr1> Cue Linux Style guide excerpt about how too many indentation levels == bad |
01:39:02 | FromGitter | <awr1> in general though while adopting a new style might be awkward you get used to it eventually. certainly i didn't like nim's pythonic indentation style the first time i tried it, but gradually grew to prefer it |
01:39:43 | * | Cthalupa quit (Ping timeout: 260 seconds) |
01:41:52 | FromDiscord | <Rika> @KingDarBoja well, i guess you can go have fun doing none type and some value and optionval.get() and stuff like that |
01:42:08 | FromDiscord | <Rika> also, not compiletime i dont think |
01:42:21 | FromDiscord | <KingDarBoja> I was being funny, not serious |
01:42:23 | FromDiscord | <KingDarBoja> π |
01:42:35 | FromDiscord | <Rika> ok |
01:42:46 | FromDiscord | <KingDarBoja> I still need to look the advantages for each one, so far using the Options one |
01:43:47 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hG6 leorize, I had to read the whitespaceOnly as this case wasn't stripping the leading whitespace |
01:43:53 | FromDiscord | <KingDarBoja> the regex I mean |
01:44:00 | FromDiscord | <Rika> i really only use options when "the value has a none type other than 0 or "" or whatever default" |
01:44:01 | * | xcm is now known as Guest15637 |
01:44:13 | FromDiscord | <Rika> aka "if the field is empty and theres no default" |
01:44:35 | * | Guest15637 quit (Read error: Connection reset by peer) |
01:44:54 | FromDiscord | <KingDarBoja> Nvm, it doesn't |
01:45:18 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hG8 π€ |
01:45:34 | * | Cthalupa joined #nim |
01:45:49 | * | xcm joined #nim |
01:46:14 | FromDiscord | <KingDarBoja> Rika: Well it seems my use case, mostly for `MyCustomType or seq[MyCustomType]` on proc parameter (with multiple params being like this) |
01:52:24 | * | Cthalupa quit (Ping timeout: 256 seconds) |
01:54:55 | * | Cthalupa joined #nim |
01:55:37 | FromGitter | <awr1> https://play.nim-lang.org/#ix=2hGd |
01:55:41 | FromGitter | <awr1> my take on it |
01:56:21 | FromGitter | <awr1> probably broken |
01:56:30 | FromDiscord | <KingDarBoja> We are using the base implementation of Python textwrap.dedent |
01:57:04 | FromDiscord | <KingDarBoja> In this case, Leo and I did the implementation on Nim by following almost the same algorithm |
01:57:24 | FromDiscord | <KingDarBoja> I said almost because Leo optimized the loop |
01:57:39 | FromDiscord | <KingDarBoja> Or well, fixed my broken implementation lol |
01:57:53 | FromDiscord | <KingDarBoja> But all cases passing except this one xD |
01:58:52 | FromDiscord | <KingDarBoja> Also awr1, you are asuming it start and ends with braces, which is not the only use case π |
02:01:53 | leorize | ok so why did you ping me? |
02:02:36 | * | Jjp137 quit (Read error: Connection reset by peer) |
02:02:53 | * | Jjp137 joined #nim |
02:03:41 | FromGitter | <awr1> ya i figured |
02:03:57 | FromGitter | <awr1> the python version is probably correct |
02:04:39 | FromDiscord | <KingDarBoja> I didn't ping you lol |
02:05:04 | leorize | ah mentioning someone name is pinging in irc land :P |
02:05:08 | FromDiscord | <KingDarBoja> Unless typing ur name means |
02:05:11 | FromDiscord | <KingDarBoja> Ok, then I did |
02:05:17 | FromDiscord | <KingDarBoja> You saw the example? |
02:12:42 | leorize | yea, what about it? |
02:14:59 | FromDiscord | <KingDarBoja> Not sure why it didn't worked out |
02:15:29 | FromDiscord | <KingDarBoja> Did we miss something? |
02:17:36 | leorize[m] | what didn't work? |
02:18:22 | leorize[m] | if you're talking about this: https://play.nim-lang.org/#ix=2hG8, then it's working exactly as it should |
02:19:42 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hGj |
02:20:08 | FromDiscord | <KingDarBoja> Well, was basically the same example but I put the expected result on a comment in this case |
02:20:43 | FromDiscord | <KingDarBoja> Unless... |
02:20:47 | FromDiscord | <KingDarBoja> Wait a minute... |
02:21:49 | leorize[m] | https://play.nim-lang.org/#ix=2hGl |
02:21:51 | leorize[m] | I reframed it a bit |
02:21:58 | leorize[m] | now can you see why it's working as expected? |
02:23:08 | FromDiscord | <KingDarBoja> Yeah, just checking if Python did the same, so weird |
02:23:52 | leorize[m] | it's not weird when you think about it :P |
02:24:11 | FromDiscord | <KingDarBoja> Yeah yeah, got the thing |
02:24:37 | FromDiscord | <KingDarBoja> It's a matter of how it is written on the statement |
02:24:51 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hGn |
02:26:37 | leorize[m] | please don't tell me you're really using `dedent` just so you can have your string indented :P |
02:26:42 | * | muffindrake quit (Ping timeout: 265 seconds) |
02:27:37 | FromDiscord | <KingDarBoja> No no.. |
02:28:50 | * | muffindrake joined #nim |
02:29:24 | FromDiscord | <Rika> does graphql even care about indent |
02:29:33 | FromDiscord | <Rika> it has braces for gods sake |
02:30:30 | FromDiscord | <KingDarBoja> It's more like a utility |
02:30:42 | FromDiscord | <KingDarBoja> Calm down π |
02:33:17 | leorize[m] | https://play.nim-lang.org/#ix=2hGq as far as Nim goes this is how we usually write our long string literals |
02:33:36 | leorize[m] | the first newline will be removed |
02:34:06 | leorize[m] | but not the last though, so if you don't want that one you gotta inline the closing `"""` with the last line |
02:39:55 | shashlick | @leorize - if nim ast cannot store comments, how does nimpretty work? |
02:40:52 | FromDiscord | <Rika> i assume with the raw text |
02:41:35 | FromDiscord | <Rika> or maybe it parses the ast but modifies as raw text, then does the comments after that |
02:42:11 | shashlick | sounds too messy |
02:42:28 | shashlick | anyway, i'd really like comments support |
02:47:18 | FromDiscord | <Chiqqum_Ngbata> Is there no way to get -o compile flag value at compile time (linux) |
02:47:58 | leorize | shashlick: yep, raw text + ast :p |
02:48:13 | shashlick | eww |
02:48:14 | leorize | Chiqqum_Ngbata: see std/compilesettings |
02:49:03 | shashlick | so i'd have thought that at least for nimpretty, you'd end up with comments support in the ast |
02:49:19 | leorize | nah, the AST isn't a miracle |
02:49:31 | shashlick | cause then all you'd do is read nim to ast and then render it back out and you have standard looking nim |
02:49:41 | shashlick | but life's never that easy |
02:49:47 | FromDiscord | <Rika> not exactly no? |
02:49:47 | leorize | it has most of the syntax elements there, but it has none that nimpretty actually care about |
02:50:11 | leorize | also the renderer don't give out idiomatic nim code :p |
02:50:15 | FromDiscord | <Chiqqum_Ngbata> Perfect, thanks |
02:50:24 | leorize | most of the time the code looks fine |
02:50:41 | leorize | but when you go for a full file it looks kinda weird |
02:50:52 | leorize | also nimpretty care about stuff that the AST can't capture |
02:51:03 | leorize | not really "can't" but more of "doesn't make sense to" |
02:51:12 | leorize | like how much indent is being used for one space |
02:51:29 | leorize | how much spaces is being used as an indent is what I meant :P |
02:55:12 | FromDiscord | <Skaruts> am I the only one who finds two spaces unreadable? |
02:55:24 | FromDiscord | <Skaruts> just curious π |
02:56:19 | FromDiscord | <Skaruts> (not quite unreadable, just a bit confusing) |
02:58:53 | FromDiscord | <Elegant Beef> I do |
02:59:27 | FromDiscord | <Elegant Beef> I much prefer indents equal to 8 characters, cause im weird and prefer clear indentation |
03:00:51 | FromDiscord | <Skaruts> π |
03:01:13 | FromDiscord | <Skaruts> that's a bit too much for me |
03:01:18 | FromDiscord | <Skaruts> but I understand |
03:01:23 | FromDiscord | <Elegant Beef> Which is why im very pro-tabs, cause why not |
03:04:05 | FromDiscord | <Skaruts> yea me too... |
03:05:10 | FromDiscord | <Skaruts> I have a bit of a problem here: I have a template that takes a block of code, but I'd like to give it a few named parameters, BUT that creates the problem that they must go after the code-block parameter, but that doesn't compile when I call the template with the named one before the block |
03:05:16 | FromDiscord | <Skaruts> Is there some way to turn the code-block parameter into a named parameter? |
03:06:59 | FromDiscord | <Skaruts> this is my template sig: `template button*(x, y:int, text:string, code:untyped):untyped =` |
03:08:44 | FromDiscord | <Skaruts> the goal was to give it optional parameters for styling and other button properties, with default values |
03:09:24 | * | oculux quit (Quit: blah) |
03:09:55 | * | oculux joined #nim |
03:10:48 | FromDiscord | <Skaruts> I could go with overloads, but I think that would force me to have an additional overload for each additional optional parameter... |
03:12:51 | FromDiscord | <KingDarBoja> https://nim-lang.org/docs/marshal.html just found this right now |
03:14:51 | FromDiscord | <KingDarBoja> But eww at the output on some type |
03:15:52 | FromDiscord | <KingDarBoja> Seems like it was a mistake trying to use initTable as default value |
03:24:12 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
03:27:12 | * | xcm quit (Remote host closed the connection) |
03:28:24 | shashlick | @leorize but isn't the whole point of Nim pretty to give a consistent output independent of existing formatting and indent |
03:29:17 | shashlick | And if the renderer isn't pretty enough, it could be updated |
03:29:25 | * | xcm joined #nim |
03:33:56 | FromDiscord | <Skaruts> nevermind my problem, I actually managed to use overloads in a much simpler way that I was thinking |
03:35:23 | FromDiscord | <KingDarBoja> Show us? π |
03:36:00 | FromDiscord | <KingDarBoja> I am curious because been using Options module for that case but starting to feel the struggle of using some, none and get() as Rika said |
03:36:58 | * | xcm quit (Read error: Connection reset by peer) |
03:38:06 | leorize | shashlick: no, actually nimpretty respects its user |
03:39:02 | * | xcm joined #nim |
03:44:49 | * | dddddd quit (Ping timeout: 265 seconds) |
03:50:08 | shashlick | is there any way to control the order in which dynlibs are loaded |
03:50:31 | shashlick | actually, i don't think that will help |
03:51:15 | shashlick | loading libbass and libbass_fx as dynlib doesn't work since libbass_fx looks for libbass and cannot find its procs even though it is loaded |
03:51:46 | shashlick | works on windows, not on linux |
03:55:29 | * | Zectbumo quit (Remote host closed the connection) |
03:58:42 | FromDiscord | <Avatarfighter> Does anyone know if nim already has a UDP hole punching library? I'm making one right now because I couldn't find one but just incase someone knows one |
03:59:32 | FromDiscord | <Avatarfighter> and as I say that I find treeform's NetPipe library |
04:01:56 | FromDiscord | <KingDarBoja> Anyone knows how to provide a default value to some Table[string, string] as proc parameter? |
04:05:11 | * | silvernode joined #nim |
04:06:01 | * | supakeen quit (Quit: WeeChat 1.9.1) |
04:06:44 | * | supakeen joined #nim |
04:26:02 | * | noonien quit (Quit: Connection closed for inactivity) |
04:37:56 | * | Guest85 joined #nim |
04:41:42 | FromGitter | <awr1> @shashlick strange. i thought the dynamic loader on linux also skips if a dynlib is already loaded into memory |
04:50:51 | * | Hexeratops quit (Read error: Connection reset by peer) |
04:52:24 | shashlick | ya but i think the way Nim loads dynlibs with the {.importc, dynlib: "xyz".} is not the same as -lxyz |
04:52:31 | shashlick | when I changed it, it worked fine |
05:00:42 | * | silvernode quit (Ping timeout: 256 seconds) |
05:16:58 | * | Zectbumo joined #nim |
05:24:50 | * | lritter quit (Ping timeout: 256 seconds) |
05:25:24 | shashlick | finished porting nimbass to ast2 - https://github.com/genotrance/nimbass/tree/nimterop |
05:28:40 | * | narimiran joined #nim |
05:29:46 | shashlick | @jyapayne - added nim-sdl2 to https://github.com/nimterop/nimterop/wiki/Wrappers |
05:36:00 | * | Guest85 quit (Quit: My Mac Pro has gone to sleep. ZZZzzzβ¦) |
05:39:12 | * | nsf joined #nim |
05:44:41 | * | hax-scramper quit (Ping timeout: 258 seconds) |
05:57:48 | * | Jjp137 quit (Read error: Connection reset by peer) |
05:58:23 | * | Jjp137 joined #nim |
06:01:20 | * | Jjp137 quit (Read error: Connection reset by peer) |
06:04:02 | * | Jjp137 joined #nim |
06:12:31 | * | hax-scramper joined #nim |
06:31:30 | lbart | Hi, I have a problem with the forum. I can't activate my mail (so I can't post) since I never received the link to activate it. I deleted and recreated it several times, but each times. I have "an error has occured", long minutes after a mail with the link, and when I go the link to activate my account. I have a "Invalid ident hash" |
06:31:45 | lbart | Any idea? Solution? |
06:31:46 | lbart | Thanks |
06:36:30 | * | solitudesf joined #nim |
06:49:11 | leorize[m] | lbart: ping dom96 |
06:53:34 | * | xcm quit (Remote host closed the connection) |
06:56:22 | * | xcm joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:05:04 | * | gmpreussner joined #nim |
07:17:20 | * | hax-scramper quit (Read error: Connection reset by peer) |
07:17:40 | * | hax-scramper joined #nim |
07:26:14 | * | zedeus quit (Quit: zedeus) |
07:30:03 | * | hax-scramper quit (Ping timeout: 265 seconds) |
07:30:50 | * | hax-scramper joined #nim |
07:32:26 | * | zedeus joined #nim |
07:33:24 | * | hax-scramper quit (Read error: Connection reset by peer) |
07:33:41 | * | hax-scramper joined #nim |
07:34:15 | FromGitter | <sheerluck> github told me "dom96 starred Pebaz/nimporter 9 hours ago" |
07:34:20 | FromGitter | <sheerluck> so I immediately became interested |
07:34:25 | FromGitter | <sheerluck> added {.exportpy.} to my mkv.nim |
07:34:31 | FromGitter | <sheerluck> and when I said "import nimporter, mkv" inside of ipython, I've got a result |
07:34:36 | FromGitter | <sheerluck> It feels like magic |
07:34:42 | FromGitter | <sheerluck> https://media.giphy.com/media/VHngktboAlxHW/giphy.mp4 |
08:03:46 | * | tane_ joined #nim |
08:04:36 | * | hax-scramper quit (Ping timeout: 258 seconds) |
08:05:32 | * | hax-scramper joined #nim |
08:07:29 | * | s4mu3lbk joined #nim |
08:10:50 | * | Zectbumo quit (Remote host closed the connection) |
08:35:12 | * | liblq-dev joined #nim |
08:36:17 | * | nsf quit (Quit: WeeChat 2.8) |
08:39:59 | * | zedeus quit (Quit: zedeus) |
08:44:07 | * | zedeus joined #nim |
08:51:08 | * | krux02 joined #nim |
09:18:05 | * | dddddd joined #nim |
09:21:06 | dadada | sheerluck: agree |
09:25:24 | dadada | my only mild criticism would be, why do you need {.exportpy.}, couldn't it simply import everything by default? |
09:28:51 | Yardanico | dadada: well it needs that pragma to be able to know which stuff to import |
09:28:55 | dadada | I'd love to see some performance tests of nimporter put against cython or the like |
09:28:57 | Yardanico | I think it would be harder without the pragma |
09:30:59 | dadada | Yardanico: in all the examples they're importing everything, might as well just create a macro that parses the whole file and adds the {.exportpy.} macro to all funcs/procs, and then the usual processing could start |
09:31:11 | Yardanico | dadada: well that's examples |
09:31:15 | Yardanico | in real life you wouldn't always do that :) |
09:31:24 | Yardanico | and exportpy comes from nimpy |
09:31:36 | Yardanico | https://github.com/yglukhov/nimpy |
09:32:15 | dadada | ah, didn't know that came from nimpy, still, this could be made more comfortable, I think the usual case for this is that you'll be wanting to use a nim module in python, the same way you'd use this nim module in nim |
09:32:35 | Yardanico | well nimpy isn't only calling nim from python, it's also for calling python from nim |
09:32:40 | dadada | and when using a nim module in nim, obviously no special macros are needed |
09:33:29 | Yardanico | well I understand what you mean but I think it would be harder to do |
09:33:47 | Yardanico | since you'll have to circumvent the compiler and manually include the needed nim files via macros |
09:33:59 | Yardanico | well, or just put a pragma call on the top of the file |
09:34:38 | dadada | it would only be marginally harder, as I said, you simply write a macro that reads the whole module as a block of code, then puts the {.exportpy.} in the right places, saves this to a tmp-location, and then the same algorithm as used now gets used on this tmp-location, done |
09:34:52 | Yardanico | well that seems hacky for me :P |
09:35:10 | Yardanico | I don't think it's worth the effort honestly |
09:35:49 | dadada | Yardanico: the point is that you shouldn't have to put a pragma/macro in the file at all, I suppose people have working nim modules, when the goal is to make them seamlessly available in python, the ideal is not to have to touch the file at all |
09:36:19 | dadada | Yardanico: and I think the effort isn't even that high to do it |
09:37:20 | Prestige | I'm going to have to re-read much of the docs, there's a lot to take in |
09:37:38 | dadada | in an ideal world you do not have to maintain two versions of the same module, one for using it with python, one for using it in a nim project as usual, you'll ideally just want to have one file and one source history |
09:40:35 | * | dwdv joined #nim |
09:50:49 | * | endragor joined #nim |
09:58:53 | dom96 | lbart, give me your nickname and I'll activate for you |
10:00:29 | * | gangstacat quit (Quit: Δis!) |
10:06:30 | FromGitter | <zacharycarter> What does drnim do? I got it compiling and ran it against a source file but it didn't produce any binary or anything |
10:06:39 | Yardanico | it allows you to add special pragmas |
10:06:59 | FromGitter | <zacharycarter> ah |
10:07:08 | Yardanico | see doc/drnim |
10:07:18 | FromGitter | <zacharycarter> thanks |
10:09:36 | dadada | https://www.phoronix.com/scan.php?page=news_item&px=Wasmtime-Go-WebAssembly |
10:10:00 | dadada | can't wait for Nim bindings for this |
10:10:24 | dadada | "Wasmtime has already provided bindings for Rust, C, Python, and Microsoft .NET while Go is the latest on the list." |
10:11:23 | FromDiscord | <Recruit_main707> I want flatbuffers for Nim |
10:11:33 | FromDiscord | <Recruit_main707> That would be great |
10:15:52 | dadada | Recruit_main707: I support you in that wish |
10:18:17 | dadada | Recruit_main707: stuff like this would have been perfect for a GoogleSummerOfCode |
10:20:35 | FromDiscord | <Recruit_main707> I will open an issue on the GitHub repo and try |
10:23:51 | dadada | Recruit_main707: awesome |
10:24:13 | FromGitter | <gogolxdong> Is there any Fourier transform library? |
10:26:29 | Zevv | yes |
10:26:48 | Zevv | !package fftw3 |
10:31:43 | * | noonien joined #nim |
10:31:54 | FromGitter | <sealmove> Hi everyone |
10:41:39 | FromGitter | <faulander> hi guys |
10:42:16 | planetis[m] | hi |
10:51:59 | * | Vladar joined #nim |
11:00:28 | FromGitter | <Vindaar> @gogolxdong there are also bindings to kiss fft |
11:04:50 | * | narimiran quit (Ping timeout: 256 seconds) |
11:23:18 | planetis[m] | are there any plans for the enumerate macro to replace pairs iterators or was abandoned? |
11:25:13 | planetis[m] | there is an rfc: https://github.com/nim-lang/RFCs/issues/74 |
11:25:17 | planetis[m] | great |
11:31:26 | * | jjido joined #nim |
11:48:41 | FromDiscord | <sealegs> Hey guys is there a way to convert string to int64? I've tried using parseInt but I get a value error saying that it's out of range. |
11:49:33 | FromDiscord | <Generic> try parseBiggestInt |
11:49:45 | FromDiscord | <Generic> and cast that one to int64 |
11:53:14 | krux02 | biggest int is int64 |
11:53:29 | FromDiscord | <sealegs> it says "Error: type mismatch: got <int64> but expected 'int" |
11:53:56 | FromDiscord | <sealegs> code: |
11:53:56 | FromDiscord | <sealegs> ```nim |
11:53:57 | FromDiscord | <sealegs> proc getShardID*(gid: string): int = |
11:53:57 | FromDiscord | <sealegs> result = (parseBiggestInt(gid) shl 22) mod 1 |
11:53:57 | FromDiscord | <sealegs> ``` |
11:54:11 | FromGitter | <sealmove> the box that appears when you search in nim docs looks shitty in dark mode |
11:54:12 | krux02 | yes the type is not automatically converted, but what I mean it is actually a 64 bit integer. |
11:54:26 | FromDiscord | <Recruit_main707> `(gid: string): int64` the return type must be int64 |
11:54:27 | krux02 | there is currently no supported platform where the biggest int is more than that. |
11:54:37 | FromGitter | <sealmove> guys parseBiggestInt returns an int |
11:55:51 | FromGitter | <sealmove> actually there is `parseutils.parseBiggestInt` and `strutils.parseBiggestInt` |
11:56:26 | FromGitter | <sealmove> sealegs you need `strutils`'s one |
11:56:39 | FromDiscord | <Recruit_main707> that doesnt seem the issue, its just that result expects an int |
11:56:43 | FromDiscord | <Recruit_main707> not in64 |
11:56:54 | FromDiscord | <sealegs> I already imported strutil's one |
11:57:30 | krux02 | sealmove: parseutlis.parseBiggestInt returns an int that is not the parsed int |
11:58:21 | krux02 | sealegs: you should convert the result of parseBiggestInt into an actual int |
11:58:49 | krux02 | result = int((parseBiggestInt(gid) shl 22) mod 1) |
11:59:23 | krux02 | int(expr) is a range checked conversion to int |
11:59:51 | krux02 | cast[int](expr) is a non range checked bit copy |
12:00:23 | * | krux02 quit (Read error: Connection reset by peer) |
12:00:44 | FromGitter | <sealmove> ah right |
12:03:00 | * | superbia joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 1.9.1) |
12:06:47 | * | supakeen joined #nim |
12:08:12 | FromGitter | <sealmove> guys, what's an easy workaround for recursive module dependency when you can't move types from file to other file? |
12:08:30 | FromGitter | <sealmove> `include`? |
12:08:31 | * | superbia left #nim ("WeeChat 2.4") |
12:11:16 | FromGitter | <sealmove> or is there an experimental feature that takes care of it? |
12:13:18 | FromGitter | <sealmove> a hack is fine by me for now |
12:13:46 | * | dadada quit (Ping timeout: 265 seconds) |
12:15:18 | FromGitter | <zacharycarter> I haven't used this in anything beyond a very simple test - but I was able to get hot reloading working with `--gc:arc` and `cr.h` |
12:15:25 | * | dadada joined #nim |
12:15:43 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzzβ¦) |
12:15:48 | * | dadada is now known as Guest28737 |
12:15:57 | FromGitter | <zacharycarter> will play around with it more later today - I was hoping shaslick's plugin project would work with `--gc:arc` but the tests fail presently |
12:19:12 | * | s4mu3lbk quit (Quit: WeeChat 2.3) |
12:26:44 | * | narimiran joined #nim |
12:26:50 | planetis[m] | sealmove: https://forum.nim-lang.org/t/4745 |
12:32:13 | * | hax-scramper quit (Read error: Connection reset by peer) |
12:33:03 | * | gangstacat joined #nim |
12:33:05 | * | hax-scramper joined #nim |
12:36:59 | FromGitter | <sealmove> oh actually maybe I can solve it with export |
12:37:32 | FromGitter | <sealmove> https://nim-lang.org/docs/manual.html#modules-export-statement |
12:40:53 | shashlick | @zacharycarter will be awesome to get plugins working with arc |
12:41:07 | shashlick | That's the eventual goal |
12:41:18 | FromGitter | <zacharycarter> I agree - I'm just not sure how to do so at the moment |
12:41:50 | shashlick | I need to port nimterop as well to work with arc |
12:42:01 | shashlick | Too much to do, only so much time |
12:47:18 | shashlick | For plugins, need to compile the plugins also with arc, not just the main binary |
12:48:36 | FromGitter | <zacharycarter> how should the plugins be named>? |
12:48:38 | FromGitter | <zacharycarter> ? |
12:48:47 | FromGitter | <zacharycarter> running the tests is a bit poorly documented I think |
12:50:43 | FromGitter | <zacharycarter> does the test command also compile the plugins? |
12:51:02 | FromGitter | <zacharycarter> I tried building a dylib from them myself but every time I run test they get deleleted |
12:53:07 | FromGitter | <zacharycarter> oh I see the plugins module compiles it for you - okay let me try that |
12:54:08 | * | ikan_keli joined #nim |
13:00:17 | FromGitter | <zacharycarter> yeah - crashes still when plugins are compiled with `--gc:arc` |
13:08:29 | * | Guest85 joined #nim |
13:25:41 | * | Guest85 quit (Quit: My Mac Pro has gone to sleep. ZZZzzzβ¦) |
13:28:42 | * | jjido joined #nim |
13:47:03 | FromDiscord | <jb> hi guys |
13:47:28 | FromDiscord | <jb> I'm compiling the following to the JS target: |
13:47:29 | FromDiscord | <jb> import jsconsole |
13:47:29 | FromDiscord | <jb> type MyEnum {.pure.}= enum |
13:47:29 | FromDiscord | <jb> One = "A".cstring, Two = "B".cstring |
13:47:29 | FromDiscord | <jb> console.log(MyEnum.One) # output: 0, expected: "A" |
13:47:30 | FromDiscord | <jb> Is this a bug? |
13:48:30 | Yardanico | is it the same if you try console.log($MyEnum.One) ? |
13:48:46 | Yardanico | also please don't make code pastes in discord, it's a bit ugly for people in IRC here :P |
13:49:42 | FromDiscord | <jb> Ah that did the trick, awesome. Sorry didn't know about the line splitting bot |
13:50:24 | Yardanico | well I think the reason why the behaviour is different is because "echo" in Nim calls $ for all arguments, and console.log doesn't do that, so it outputs the numerical value of the enum element |
13:53:31 | FromDiscord | <jb> That must be it, thanks a lot |
13:53:57 | Yardanico | you can just use "echo" though I think |
13:54:05 | Yardanico | no need for console.log, "echo" will work for JS target too |
13:54:48 | Yardanico | nim "echo" in JS target uses console.log anyway |
13:56:24 | FromDiscord | <jb> cool, didn't know that |
14:00:53 | * | krux02 joined #nim |
14:02:26 | * | Guest85 joined #nim |
14:07:55 | * | tane_ is now known as tane |
14:15:54 | FromDiscord | <kodkuce> hmm is something wrong with 1.2 and async, just tryed to run exmaplel form https://nim-lang.org/docs/asynchttpserver.html |
14:15:59 | Yardanico | yes |
14:16:02 | FromDiscord | <kodkuce> basic usage simplest example |
14:16:04 | Yardanico | it's already fixed in devel and will be in 1.2.2 |
14:16:23 | FromDiscord | <kodkuce> so i can do chosenim head |
14:16:28 | FromDiscord | <kodkuce> and it will wokr |
14:16:31 | Yardanico | https://github.com/nim-lang/Nim/issues/13866 |
14:16:45 | FromDiscord | <kodkuce> devel |
14:16:49 | Yardanico | yep |
14:17:23 | Yardanico | it's quite sad that it got into 1.2.0 but now we have proper tests for asynchttpserver :) |
14:17:24 | FromDiscord | <kodkuce> hmm oh i frogot this mereged to irc |
14:17:33 | FromDiscord | <kodkuce> wanted to say ty |
14:17:45 | lbart | dom96: Thanks, my username is lbartoletti |
14:17:48 | FromDiscord | <kodkuce> duno what does thunb up icon do ower irc or whawer |
14:18:08 | * | Guest85 quit (Quit: My Mac Pro has gone to sleep. ZZZzzzβ¦) |
14:18:30 | dom96 | lbart, getting a 404 for that, did you delete the account? |
14:18:48 | lbart | dom96: Yes, and I try to recreate it |
14:19:00 | lbart | I receive a mail to activate it |
14:19:07 | lbart | but I got an "invalid ident hash" |
14:19:14 | dom96 | right, well I cannot bring that one back |
14:19:17 | dom96 | at least not easily |
14:19:27 | dom96 | do you have another account you didn't delete? |
14:19:52 | lbart | I can create a new one |
14:20:56 | lbart | dom96: "lbart" is created and activated |
14:21:14 | lbart | (with the same adress as my former nickname) |
14:21:27 | lbart | and the mail was instantanely |
14:21:36 | dom96 | good, I gave you "user" permissions |
14:24:17 | lbart | dom96: thanks |
14:25:37 | * | ikan_keli quit (Ping timeout: 260 seconds) |
14:26:33 | * | liblq-dev quit (Ping timeout: 250 seconds) |
14:28:26 | * | liblq-dev joined #nim |
14:32:09 | * | Guest28737 is now known as dadada |
14:41:11 | * | aEverr quit (Ping timeout: 265 seconds) |
14:41:11 | * | PMunch joined #nim |
14:41:56 | * | aEverr joined #nim |
14:43:55 | FromDiscord | <Recruit_main707> can macros affect emitted code?? |
14:44:06 | Yardanico | what do you mean exactly? |
14:44:16 | Yardanico | well macros can insert "emit" calls to emit raw C and stuff |
14:44:20 | FromDiscord | <Recruit_main707> its hard to explaint, wait a min |
14:45:26 | FromDiscord | <__ibrahim__> is there a way to automatically generate procs from a C or C++ lib? |
14:45:38 | Yardanico | nimterop works for most C libraries |
14:45:48 | Yardanico | but it still requires some manual work |
14:46:01 | FromDiscord | <__ibrahim__> nice |
14:46:07 | FromDiscord | <__ibrahim__> cpp is manual |
14:46:14 | FromDiscord | <__ibrahim__> ? |
14:46:27 | Yardanico | well there's c2nim which will work for some stuff, also nimterop might work a bit too |
14:46:51 | FromDiscord | <__ibrahim__> thanks mate! im asking coz i couldnt find 3d physics in nimble |
14:49:07 | FromDiscord | <Recruit_main707> this is more or less what i want to do: https://play.nim-lang.org/#ix=2hJn (i know about nimpy, this is different) |
14:49:56 | Yardanico | well yeah you should be able to do this |
14:50:03 | supakeen | Yardanico: Thanks for putting that back in my mind, I need to extend those tests to cover more of it now that the basis is there. Especially now that my own projects are running out of issues with all this staying at home stuff :) |
14:50:04 | Yardanico | macros can add ANY ast to valid Nim code |
14:50:14 | Yardanico | well I mean valid Nim syntax |
14:50:15 | Yardanico | not code |
14:50:20 | Yardanico | https://nim-lang.org/docs/macros.html#callsslashexpressions-pragmas |
14:50:21 | supakeen | Is there any sort of coverage report for the nim testcases I could generate by the way? |
14:51:07 | * | endragor quit (Remote host closed the connection) |
14:52:50 | Yardanico | also @Recruit_main707 in the case of an example you've shown you can get away with a template I think |
14:53:01 | Yardanico | ah no, you want to apply it as a pragma, sorry |
14:53:36 | FromDiscord | <Recruit_main707> yes, and i will have to modify more things of the function body also very likely |
14:53:51 | Yardanico | yeah then you need a macro |
14:59:00 | * | Tyresc joined #nim |
15:08:17 | * | ryukoposting quit (Quit: Leaving) |
15:10:58 | * | endragor joined #nim |
15:11:35 | shashlick | @zacharycarter thanks for checking |
15:14:26 | zedeus | shashlick your telegram bot is reposting images |
15:15:28 | * | endragor quit (Ping timeout: 258 seconds) |
15:15:41 | FromDiscord | <kodkuce> hmm is there an easyer way to format this string """<div> <a href="""" & $MYVARHERE & """">Visit W3Schools.com!</a>""" |
15:16:42 | Yardanico | strformat module |
15:16:48 | FromDiscord | <kodkuce> frogot closing div on end but, my point is if i have strings that contain " and i need in them to put my vairables is there some faster thing like |
15:16:51 | FromDiscord | <kodkuce> ok will check |
15:19:55 | * | inv2004 joined #nim |
15:20:47 | FromDiscord | <kodkuce> hmm i think i am blind |
15:20:58 | PMunch | kodkuce, you can backslash escape " |
15:22:10 | FromDiscord | <kodkuce> <a href="""" & $MYVARHERE & """"> beacomes <a href="/ $MYVARHERE /"> or what |
15:22:27 | FromDiscord | <kodkuce> lol i even mised backshals postion |
15:23:04 | PMunch | And those are forward slashes :P |
15:23:31 | FromDiscord | <kodkuce> oh ye that too xD |
15:24:49 | FromDiscord | <kodkuce> ok got it working ty :0 |
15:25:08 | FromDiscord | <kodkuce> and i missed now ) should buy new hands of kayboard |
15:26:46 | inv2004 | Hi, can someone explain the magic: I have a file with lines like "> test line\r\nABC", when I do file.readline(line): echo line - it outputs " test line\n A B C\n". |
15:27:22 | inv2004 | So => I do not see '>' and spaces? why ? |
15:28:09 | PMunch | Because you're reading the wrong file? |
15:28:55 | * | NimBot joined #nim |
15:29:12 | Yardanico | https://play.nim-lang.org/#ix=2hJJ |
15:29:13 | Yardanico | works just fine |
15:30:05 | Yardanico | https://play.nim-lang.org/#ix=2hJK this works too |
15:30:51 | inv2004 | Can you try this file? https://gofile.io/?c=s8RJDZ |
15:31:14 | inv2004 | I am very confused: I have one file which works on, and another one which is not. but in vscode both of them are ok |
15:31:23 | inv2004 | on = ok |
15:31:44 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzzβ¦) |
15:32:17 | Yardanico | inv2004: it probably doesn't work because it's not just > |
15:32:30 | Yardanico | repr for the first line gives this |
15:32:30 | Yardanico | 0x7f615e6b7058"\255\254>\0O\0N\0E\0 \0H\0o\0m\0o\0 \0s\0a\0p\0i\0e\0n\0s\0 \0a\0l\0u\0\13\0" |
15:32:36 | Yardanico | so there are \255 and \254 before the > |
15:32:53 | PMunch | UTF BOM marker? |
15:33:08 | inv2004 | hm, hm, hm. Thank you |
15:33:40 | inv2004 | Looks like something wrong ... with Rust which generated it :) |
15:33:45 | Yardanico | PMunch: seems like it's UTF-16 little-endian BOM xdd |
15:33:52 | Yardanico | 0xFF 0xFE |
15:34:05 | PMunch | Yardanico :D |
15:34:42 | Yardanico | but it should be fine after you skip those two bytes I think |
15:35:07 | * | jjido joined #nim |
15:35:11 | Yardanico | since all of it is just plain ASCII except those two first bytes |
15:35:16 | PMunch | Well, the file is still UTF-16 |
15:35:21 | PMunch | See all those \0 in there? |
15:35:26 | Yardanico | ah right |
15:35:37 | PMunch | And since it's LE it's not ASCII compatible |
15:35:50 | Yardanico | yeah you're right |
15:35:52 | PMunch | Well, it wouldn't be either way.. |
15:36:14 | PMunch | So Nim prints all the way to str.len, that's nice to know |
15:37:01 | Yardanico | yeah, seems like it ignores null terminator in these lines |
15:38:47 | * | inv2004 quit (Ping timeout: 260 seconds) |
15:46:42 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzzβ¦) |
15:51:55 | * | al1ranger joined #nim |
15:53:37 | FromDiscord | <kodkuce> hmm can i order interator first before using it or do i have to dump all from interator to seq then order it |
15:54:39 | FromDiscord | <kodkuce> in my case iterator walkDir |
15:54:56 | Yardanico | yes, you need to first get all values from it and then sort/order/etc |
15:56:18 | FromDiscord | <kodkuce> hmm then question too is there some proc that returns me all file/dirs or do i have to walkDir add, am looking in OS modul duno if i am blind or what |
15:56:32 | Yardanico | I don't think there's a module like that, you can just use toSeq from sequtils |
15:56:56 | FromDiscord | <kodkuce> ok ty |
16:13:26 | FromDiscord | <kodkuce> hmm i am getting some wierd error isent a tuple just an int? |
16:13:30 | FromDiscord | <kodkuce> var paths = toSeq( cdir.walkDir(true) ).sort do ( x,y:tuple[kind: PathComponent, path: string] ) -> int: cmp(y.kind, x.kind) |
16:13:41 | FromDiscord | <kodkuce> var result`gensym19665080: seq[type(cdir.walkDir(true))] = @[] |
16:13:41 | FromDiscord | <kodkuce> for x`gensym19665081 in walkDir(cdir, true, false): |
16:13:42 | FromDiscord | <kodkuce> add(result`gensym19665080, x`gensym19665081) |
16:13:42 | FromDiscord | <kodkuce> result`gensym19665080, do (x, y: tuple[kind: PathComponent, path: string])-> int:result = cmp( |
16:13:42 | FromDiscord | <kodkuce> y.kind, x.kind), Ascending)' has no type (or is ambiguous) |
16:13:50 | Yardanico | pls don't paste like that, people in IRC suffer :P |
16:14:03 | PMunch | Haha, was just about to type that up Yardanico :) |
16:14:13 | dadada | kodkuce: use play.nim-lang.org |
16:14:17 | FromDiscord | <kodkuce> i should start using irc for nim i alwies frogot stupit discord |
16:15:48 | FromDiscord | <kodkuce> https://play.nim-lang.org/#ix=2hK0 |
16:16:33 | Yardanico | @kodkuce how do you want to sort? |
16:16:36 | Yardanico | by what I mean |
16:16:47 | FromDiscord | <kodkuce> basicly i just want to compere if pcDir or pcFile thats pathComponent enum |
16:16:55 | FromDiscord | <kodkuce> just wanted to put dirs on top |
16:17:01 | Yardanico | oh |
16:17:07 | Yardanico | well ok |
16:17:20 | FromDiscord | <kodkuce> am trying to make simple http server like python one + option to upload too |
16:18:28 | FromDiscord | <kodkuce> does bot show draged images or have to upload somwere else? |
16:18:37 | Yardanico | it shows images just fine (as links) |
16:19:31 | FromDiscord | <kodkuce> ok |
16:20:26 | Yardanico | @kodkuce if you want dirs on top, you can do something like "var paths = toSeq(cdir.walkDir(true)).sortedByIt(it.kind).reversed()" |
16:20:41 | Yardanico | but isn't it cleaner to have a for loop |
16:20:42 | FromGitter | <mantielero> Hello |
16:20:44 | Yardanico | hi |
16:20:59 | FromGitter | <mantielero> How can I convert a NimNode into an identifier? |
16:21:17 | Yardanico | what do you exactly mean? |
16:21:19 | FromDiscord | <kodkuce> hmm how uou mean for loop |
16:21:29 | Yardanico | @kodkuce nvm it would be a bit more complex |
16:21:37 | Yardanico | but the code i gave you will work, but also import "sequtils" |
16:21:41 | FromDiscord | <kodkuce> like from what i see only walkdirs is for going woer files |
16:22:46 | FromDiscord | <kodkuce> wtf, ) Error: internal error: environment misses: result`gensym19665080 |
16:22:52 | FromDiscord | <kodkuce> what is this gensym thingy |
16:23:06 | FromGitter | <mantielero> I want to create to create a random identifier that I can refer later. "let myname = genSym()", but I want to use it as an identifier |
16:23:28 | Yardanico | genSym proc in macros has an "ident" arg |
16:23:29 | FromDiscord | <KingDarBoja> Got a power outage last night π’ |
16:24:43 | FromDiscord | <kodkuce> hmm on nim playground it wokrs meybe its cuz devel? |
16:24:46 | FromGitter | <mantielero> when I do "myname.ident" I get a "node lacks field: ident" |
16:26:05 | Yardanico | ah well I understood what you mean |
16:26:11 | Yardanico | genSym is for creating symbols, not indents really |
16:26:37 | Yardanico | can you provide a code example? |
16:26:51 | FromGitter | <mantielero> How can I create a random ident |
16:27:03 | Yardanico | just create a random string? :P |
16:27:08 | Yardanico | randomly generated* |
16:27:11 | Yardanico | and "ident" proc |
16:27:22 | Yardanico | https://nim-lang.org/docs/macros.html#ident%2CNimNode |
16:27:36 | Yardanico | I had something like that in my own project, you can either use random module or just a global compile-time counter |
16:27:59 | Yardanico | ah actually not "ident" but newIdentNode |
16:28:05 | Yardanico | ah actually just "ident" :D |
16:29:51 | FromGitter | <mantielero> Let me try this (I have never used the playgraound): https://play.nim-lang.org/#ix=2hKa |
16:29:57 | FromDiscord | <kodkuce> https://play.nim-lang.org/#ix=2hKb can somone comfirm this crashes on devel? |
16:29:57 | FromGitter | <mantielero> Do you see the code? |
16:30:06 | Yardanico | yes |
16:30:16 | Yardanico | @kodkuce I'll check just in a sec |
16:30:56 | FromDiscord | <kodkuce> ty |
16:31:31 | Yardanico | works just fine for me on latest devel here |
16:31:36 | Yardanico | exact same code on linux |
16:31:46 | Yardanico | are you sure you're on latest devel? :P |
16:31:55 | Yardanico | it should work on 1.2.0 too |
16:32:05 | Yardanico | since it works on playground which is 1.2 |
16:32:17 | FromGitter | <mantielero> Another thing that puzzles me is the comment "Deprecated: Deprecated since version 0.18.1; All functionality is defined on 'NimNode'." Where is that functionality defined? |
16:33:27 | FromDiscord | <kodkuce> hmm i did choosenim dvel like 30min ago |
16:33:33 | FromGitter | <sealmove> on NomNode |
16:33:34 | FromDiscord | <kodkuce> meybe i broke it somwere else brb |
16:34:31 | FromGitter | <mantielero> https://play.nim-lang.org/#ix=2hKc |
16:34:41 | * | Trustable joined #nim |
16:35:13 | * | silvernode joined #nim |
16:35:31 | Yardanico | @mantielero https://play.nim-lang.org/#ix=2hKe |
16:35:43 | Yardanico | in playground it will have no output, try it locally |
16:35:48 | Yardanico | also ident argument for genSym is optional |
16:36:39 | Yardanico | just try to use `eval_ff` in your quote do and comment out eval_f |
16:36:44 | FromDiscord | <kodkuce> Yardanico: http://ix.io/2hKf |
16:37:02 | FromDiscord | <kodkuce> meybe cuz its in async |
16:37:06 | Yardanico | @kodkuce |
16:37:13 | Yardanico | it's a known issue with asynchttpserver |
16:37:16 | Yardanico | it's broken on 1.2.0 :P |
16:37:19 | Yardanico | that's already fixed in devel though |
16:37:25 | Yardanico | lemme try your code |
16:37:34 | Yardanico | it works just fine |
16:37:46 | FromDiscord | <kodkuce> did you uncooment |
16:37:50 | FromDiscord | <kodkuce> that sort before run |
16:38:02 | FromDiscord | <kodkuce> |
16:38:03 | FromDiscord | <kodkuce> https://cdn.discordapp.com/attachments/371759389889003532/698934969598476288/2020-04-12_183643.png |
16:38:14 | Yardanico | still works |
16:38:30 | Yardanico | ah nvm it doesn't |
16:38:32 | Yardanico | and I actually know whyt |
16:38:34 | Yardanico | why |
16:38:37 | FromDiscord | <kodkuce> π |
16:38:52 | FromDiscord | <kodkuce> i would like to know too |
16:38:54 | Yardanico | https://github.com/nim-lang/Nim/issues/10456 |
16:38:55 | * | Hexeratops joined #nim |
16:39:37 | Yardanico | instead split it into two lines like https://play.nim-lang.org/#ix=2hKh |
16:40:03 | FromGitter | <mantielero> I get: Error: unhandled exception: transf.nim(1112, 10) `prc.kind in routineKinds` |
16:40:09 | FromDiscord | <kodkuce> ok ty |
16:40:28 | Yardanico | @mantielero hmm that's a compiler crash :P can you share the whole code to reproduce the same issue or try to minimize it? |
16:40:35 | Yardanico | you can also open an issue on nim github |
16:43:21 | FromGitter | <mantielero> I have my code here: https://github.com/mantielero/ipopt.nim |
16:43:34 | FromGitter | <mantielero> It requires the library "ipopt" |
16:43:56 | FromGitter | <mantielero> The file that I am trying is: src/ex01.nim |
16:44:20 | FromGitter | <mantielero> It is a numerical solver that I am trying to wrap |
16:44:56 | * | jjido joined #nim |
16:45:34 | Yardanico | ok I'll try to run it locally |
16:47:01 | FromGitter | <mantielero> Thanks mate |
16:51:47 | Yardanico | sorry, it's partly my fault, it seems to happen if you try to use a node made by genSym in quote do, also - do you plan on using that eval_f procedure outside of the macro or it'll be called by code generated inside of the macro? |
16:52:25 | Yardanico | ah I understand why it's like that |
16:52:26 | Yardanico | right |
16:52:28 | FromGitter | <mantielero> It is used by code outside of the macro. |
16:52:42 | Yardanico | well then how will the user know the correct name for it? |
16:52:51 | Yardanico | since you want to generate random names each time |
16:52:54 | FromDiscord | <Recruit_main707> how did you print the ast |
16:52:59 | Yardanico | expandMacros |
16:53:12 | Yardanico | that's not for the AST though, it outputs Nim code |
16:53:23 | FromDiscord | <Recruit_main707> of a given node |
16:53:33 | Yardanico | for AST there's treeRepr, lispRepr and astGenRepr |
16:53:39 | FromDiscord | <Recruit_main707> ok thanks |
16:53:52 | Yardanico | @mantielero well your code will work if you call gensym like that "genSym(nskProc, ident="eval_f")" |
16:54:12 | Yardanico | because symbol must be of a specific kind for declaration, in our case we want to use it for a procedure so we define it to be nskProc |
16:54:34 | FromGitter | <mantielero> I will try |
16:54:36 | Yardanico | that macro will create a procedure with a name like "eval_f_13970296" |
16:54:48 | Yardanico | so I guess you might want to ask the user to provide the name for the resulting procedure |
16:56:06 | Yardanico | like that - https://play.nim-lang.org/#ix=2hKn |
16:56:38 | Yardanico | basically just remove eval_f line, add first argument to the macro "name: untyped", in quote do use it like "proc `name`" |
16:56:50 | Yardanico | and when calling the macro call it like problem(myProcName): body |
16:58:17 | FromGitter | <mantielero> I tried the nskProc thing. It seems to work, but then it fails on during linking: |
16:58:32 | FromGitter | <mantielero> Error: execution of an external program failed: 'gcc -o /home/jose/src/ipopt.nim/src/ex01 /home/jose/.cache/nim/ex01_d/stdlib_assertions.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_formatfloat.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_io.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_system.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_parseutils.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_unicode.nim.c.o |
16:58:32 | FromGitter | ... /home/jose/.cache/nim/ex01_d/stdlib_strutils.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_strformat.nim.c.o /home/jose/.cache/nim/ex01_d/@mipopt.nim.c.o /home/jose/.cache/nim/ex01_d/@mex01.nim.c.o -lm -ldl' |
16:58:43 | Yardanico | huh, can you paste full error on some paste service? |
16:58:55 | Yardanico | also as I said even with nskProc the user will not know the name of the resulting procedure |
16:58:58 | Yardanico | so he won't really be able to call it |
16:59:25 | Yardanico | so you might want to let the user name a procedure himself (like in the modified ipopt.nim file I sent above) |
17:00:21 | FromGitter | <mantielero> On second though this all might be unnecesary. Because I will end up creating the call to the function. Like in here: https://github.com/mantielero/ipopt.nim/blob/master/src/ex01.nim#L205 |
17:00:49 | Yardanico | oh maybe |
17:01:00 | FromGitter | <mantielero> But I want to be able to reference the function within the macro in any case |
17:01:18 | Yardanico | yeah, with gensym and nskProc you'll be able to do that |
17:02:18 | FromGitter | <mantielero> https://pastebin.com/dTQyteDS |
17:02:47 | FromGitter | <mantielero> Strange because it complains about multiple definitions of `eval_f` |
17:03:03 | Yardanico | yeah, strange, can you try removing nim cache by rm -rf ~/.cache/nim ? |
17:03:05 | Yardanico | and trying again |
17:04:30 | FromGitter | <mantielero> Same failure |
17:05:46 | FromGitter | <mantielero> It is strange becuase `expandMacro` shows: https://pastebin.com/nZX6GrfT |
17:06:18 | FromGitter | <mantielero> So `eval_f_12805296` shouldn't clash with anything else |
17:06:46 | Yardanico | try renaming ident in the proc to something else, maybe it'll work, not really sure |
17:10:01 | FromGitter | <mantielero> Fixed by doing: `let eval_f = genSym(nskProc, ident="eval_ff")` |
17:10:16 | FromGitter | <mantielero> I thing this might be bug in Nim |
17:11:02 | FromGitter | <mantielero> I believe it might be checking "ident" content instead of the final symbol ident |
17:11:17 | FromDiscord | <kodkuce> can i tag a global variable to be .gcsafe. so it stops harrasing me with warinings |
17:11:18 | FromGitter | <mantielero> (Not sure these are the right words) |
17:13:03 | FromDiscord | <kodkuce> let cdir = getCurrentDir() like how is this unsafe if in global |
17:13:47 | FromDiscord | <kodkuce> its not mutable so hmm |
17:14:02 | Yardanico | it talks about GC memory |
17:14:08 | Yardanico | you can ignore it if you don't use multiple threads |
17:14:15 | Yardanico | strings are GC'd in Nim |
17:16:59 | FromDiscord | <kodkuce> so if i use threads it will will not copy it to seperate thread? |
17:17:18 | Yardanico | nim has thread-local GC heap, but that'll be solved by arc memory management model which is in development |
17:17:23 | FromDiscord | <kodkuce> or GC will dump it in one thred |
17:17:36 | Yardanico | so with the current default GC you can't really pass GC'd objects between threads without using raw pointers |
17:18:08 | FromDiscord | <kodkuce> i can use raw pointer for this i guess cuz it will newer change anyway |
17:18:17 | Yardanico | you need threads? |
17:18:26 | FromDiscord | <kodkuce> or use beohem but think its better to use raw pointer |
17:18:36 | FromDiscord | <kodkuce> 9999% noth but why not |
17:18:47 | Yardanico | ??? |
17:19:56 | FromGitter | <JohnAD> @dom96 You around today? |
17:23:06 | FromDiscord | <kodkuce> Error: expression has no address; maybe use 'unsafeAddr' |
17:23:19 | Yardanico | it should be "var", not "let" if you want to get its address |
17:24:44 | FromDiscord | <kodkuce> beh i will just call evry request getCurrentDir like tard |
17:24:54 | Yardanico | why not use simple caching? |
17:25:33 | FromDiscord | <kodkuce> hmm what |
17:25:51 | FromDiscord | <kodkuce> feed me like i like metal oval things xD |
17:26:03 | Yardanico | check if less than 10 (or whatever) seconds passed since the previous request and if not, reply with old cached string |
17:26:27 | Yardanico | otherwise walk the dir again and return the new value |
17:26:34 | Yardanico | and don't forget to set the cache variable to the new value |
17:26:43 | Yardanico | and change last time too |
17:27:08 | * | Jesin quit (Quit: Leaving) |
17:27:51 | * | letto quit (Quit: Konversation terminated!) |
17:29:09 | FromDiscord | <kodkuce> hmm dont i need to build catch first, i dident know asynchttpserver stores catches automaticly, anyway my issue is this is retarded cuz getCurrentDir() is dir from where i run my server and it newer changes |
17:29:51 | * | letto joined #nim |
17:29:52 | Yardanico | ?? asynchttpserver doesn't cache anything |
17:30:10 | Yardanico | @kodkuce well you can specify absolute path to walkDir and ask the user to provide the path |
17:30:53 | Yardanico | although there's no need for caching well (I mean there is, but it would be a bit harder to implement since you'll need to use a table or two of them) |
17:30:54 | FromDiscord | <kodkuce> i think you are owerthinking what i am doing, i just trying to make like python -m http.server |
17:31:05 | FromDiscord | <kodkuce> just server currten dir |
17:31:42 | FromDiscord | <kodkuce> user has nothing to input whatewer i just need a string that will alwies be same |
17:31:53 | Yardanico | ok |
17:32:00 | FromDiscord | <kodkuce> like it gets populated on first run with let cdir = getCurrentDir() |
17:32:04 | dadada | where is disruptek? wanna watch his stream |
17:32:16 | Yardanico | dadada: his router died I think |
17:32:19 | Yardanico | so he isn't online |
17:32:29 | FromDiscord | <kodkuce> but insted using that one, now i for ewry request i do let cdir = getCurrentDir() and thats kinda retarded |
17:32:38 | Yardanico | well just do simple caching as I said |
17:33:34 | Yardanico | although python -m http.server doesn't do any caching at all |
17:33:51 | FromDiscord | <kodkuce> cuz it probbaly has curent dir in variable or someting |
17:33:56 | Yardanico | ??? |
17:34:45 | FromDiscord | <kodkuce> like i need constant path to dir from what i run myserver |
17:34:53 | Yardanico | you don't ? |
17:35:25 | Yardanico | well you might need it yeah but that's the issue |
17:35:33 | Yardanico | I just don't understand what's the problem you're having |
17:36:29 | FromDiscord | <kodkuce> hmm, like i open some Folder, and i run myNimSimpleHttpServer, i want to serve that dir and cuz of that i need to have dirpath in variable or to evry request do let cdir = getCurrentDir() thats probbaly infecient to do and retarded cuz you can store it in variable |
17:37:14 | Yardanico | if you do "let cdir = getCurrentDir()" in global scope getCurrentDir will only get called once |
17:37:26 | Yardanico | since "let" is not an alias, it's for ASSIGNING a value to a variable |
17:37:29 | FromDiscord | <kodkuce> my problem is if i expose let cdir = getCurrentDir() as global var then GC crys how its not usnefe |
17:37:37 | Yardanico | it's just a warning as I said |
17:37:44 | Yardanico | and it can be safely ignored if you don't use threads |
17:37:47 | Yardanico | and asynchttpserver doesn't |
17:38:52 | FromDiscord | <kodkuce> i know but i hate it and i say i can use gc:beohem or try that pointer thingy but then it coplains 'unsafeAddr' |
17:39:02 | Yardanico | you can disable warnings |
17:39:14 | FromDiscord | <kodkuce> hmm so asynchttpserver does not use threads if too much requests? |
17:39:23 | Yardanico | it's async so it doesn't use threading at all |
17:39:24 | FromDiscord | <kodkuce> if i turn threads:on |
17:39:30 | * | Jesin joined #nim |
17:39:39 | Yardanico | it won't use threads anyway |
17:39:46 | Yardanico | "threads:on" is not a "magical" switch |
17:39:54 | Yardanico | it doesn't magically make all of your code threaded :) |
17:40:17 | FromDiscord | <kodkuce> ye but i thinked it has some limit and if i 0thread is stucked with CPU it will spawn new thread |
17:40:34 | FromDiscord | <kodkuce> guess i watched too much harry poter then |
17:40:36 | Yardanico | it won't, and that would've been mentioned if that was the case |
17:41:04 | Yardanico | "httpbeast" can do threading by the way |
17:41:15 | Yardanico | and it's used by "jester" if you run on a supported OS like Linux |
17:41:47 | * | leorize quit (Quit: WeeChat 2.7.1) |
17:42:13 | FromDiscord | <kodkuce> hmm ye i run linux, but anyway am making this for just times when you need a simple http server and kinda dont give a crap about pefomance xD |
17:42:25 | Yardanico | well so why are you worrying so much then? :P |
17:42:47 | Yardanico | warnings are not errors |
17:43:01 | FromDiscord | <kodkuce> cuz i hate that warring thingy |
17:43:15 | FromDiscord | <kodkuce> ye i know i can suppress but i have to type stuff for that |
17:43:25 | FromDiscord | <kodkuce> guess can bash alias it |
17:43:32 | Yardanico | or you can create a config file for your nim file |
17:43:40 | Yardanico | either .cfg (old config format) or .nims (nimscript) |
17:44:04 | Yardanico | if .nims, name it "nameofyourmainnimfile.nims" and put warning("GcUnsafe", false) there |
17:44:28 | Yardanico | and put it in the same folder with your main file |
17:45:01 | FromDiscord | <kodkuce> ("GcUnsafe", false)' is of type 'tuple of (string, bool)' and has to be discarded |
17:45:14 | FromDiscord | <kodkuce> to add discard infront or what |
17:45:21 | Yardanico | in .nims |
17:45:30 | Yardanico | and ignore the errors from VSCode, it can't properly handle .nims files right now |
17:45:32 | FromDiscord | <kodkuce> yes its in simpleserver.nims |
17:45:41 | Yardanico | I mean the Nim extension |
17:45:43 | FromDiscord | <kodkuce> not in simpleserver.nim |
17:45:47 | Yardanico | it'll work fine |
17:46:00 | Yardanico | it's just that nim extension thinks that .nims is same as .nim |
17:48:11 | * | nixfreak joined #nim |
17:48:12 | FromGitter | <eagledot> Hello |
17:48:33 | nixfreak | !hash |
17:48:58 | nixfreak | !help |
17:49:02 | Yardanico | ? |
17:49:12 | nixfreak | bot commands |
17:49:17 | Yardanico | disbot is down |
17:49:22 | * | narimiran quit (Quit: leaving) |
17:49:28 | nixfreak | oh sorry didn't know |
17:50:52 | FromGitter | <eagledot> Is it possible to just forward declare a struct in C and use it in a function prototype in a header file like |
17:51:18 | leorize[m] | yea, disruptek's router is kinda broken, so disbot went with him |
17:51:43 | leorize[m] | @eagledot: I'm not sure what you're trying to achieve here... |
17:52:47 | FromGitter | <eagledot> Is it possible to forward declare a struct and then use it in a function prototype in a header file like... β `typedef struct temp` β `void function(temp **)` |
17:53:01 | FromDiscord | <sealegs> When I do `parseBiggestInt(id).int` it gives me a range error |
17:53:03 | Yardanico | how's that related to Nim? :P |
17:53:16 | Yardanico | @sealegs how the error looks like? |
17:53:48 | FromDiscord | <sealegs> ``` |
17:53:48 | FromDiscord | <sealegs> fatal.nim(48) sysFatal |
17:53:48 | FromDiscord | <sealegs> asyncfutures.nim(431) asyncCheckCallback |
17:53:49 | FromDiscord | <sealegs> asyncfutures.nim(383) read |
17:53:49 | FromDiscord | <sealegs> Error: unhandled exception: value out of range: 571359938501410826 [RangeError] |
17:53:52 | FromDiscord | <sealegs> Error: execution of an external program failed: 'C:\Users\KrispPurg\Desktop\Projects\Programming\nim-lang\discord_bots\dimscord\main.exe '``` |
17:54:23 | FromGitter | <eagledot> https://github.com/Picovoice/porcupine/blob/master/include/picovoice.h β There is this header file...i was trying to call `pv_porcupine_init` |
17:55:48 | Yardanico | @sealegs well don't convert it back to "int" then |
17:55:56 | Yardanico | seems like your' compiling for 32-bit arch so "int" is 32-bit |
17:56:06 | Yardanico | hence it can't hold this value in an "int" type |
17:56:13 | Yardanico | s/your'/you're |
17:57:00 | FromGitter | <eagledot> There is no definition of struct ..just declaration...and then it is passed into a C function ...when i try to just declare an `object type` and try to get the pointer ...it says expression has no address |
17:58:21 | leorize[m] | @eagledot: you're doing it wrong :) |
17:59:01 | FromGitter | <eagledot> `typedef struct pv_porcupine pv_porcupine_t; β void pv_porcupine_init( β β ``` pv_porcupine_t **object);```` β ... [https://gitter.im/nim-lang/Nim?at=5e9356e53a85536c4325ba39] |
17:59:24 | Yardanico | can you show nim code? |
17:59:54 | FromDiscord | <sealegs> sure |
17:59:54 | FromDiscord | <sealegs> ```nim |
17:59:54 | FromDiscord | <sealegs> proc getShardID*(id: string): int = |
17:59:54 | FromDiscord | <sealegs> result = (parseBiggestInt(id) shl 22) mod 1``` |
18:00:08 | Yardanico | well I didn't ask you @sealegs but ok :) and I already answered |
18:00:11 | * | exelotl joined #nim |
18:00:18 | FromDiscord | <sealegs> oh lol |
18:00:19 | leorize[m] | @sealegs: please don't paste code into discord |
18:00:21 | Yardanico | either compile for 64-bit or use int64 everywhere where you handle id |
18:00:25 | leorize[m] | use play.nim-lang.org for pasting |
18:00:40 | leorize[m] | `BiggestInt` is an actual type too btw |
18:00:58 | leorize[m] | @eagledot: you gotta explain what exactly does that init function take :) |
18:02:10 | FromGitter | <awr1> `type PVPorcupine = object; proc initPVPorcupine(obj :var PVPorcupine)` |
18:02:46 | FromGitter | <awr1> or `proc newPVPorcupine() :ref PVPorcupine = result.new` |
18:03:14 | leorize[m] | anyhow, this is how we would wrap it in Nim: https://play.nim-lang.org/#ix=2hL7 |
18:04:12 | FromGitter | <awr1> yeah without more context i'm confused what you're trying to do |
18:04:43 | FromGitter | <awr1> https://github.com/Picovoice/porcupine/blob/master/include/pv_porcupine.h |
18:04:47 | FromGitter | <awr1> are you trying to generate bindings to this? |
18:04:54 | FromGitter | <awr1> i reccomend nimterop |
18:05:07 | FromGitter | <awr1> https://github.com/nimterop/nimterop |
18:05:10 | FromGitter | <eagledot> @awr1 Yes.. |
18:05:53 | * | waleee-cl joined #nim |
18:06:24 | FromGitter | <eagledot> I was confused as there is no defintion of `struct pv_porcupine_t`. |
18:06:59 | FromGitter | <eagledot> The c code is passing `pv_porcupine_t **` |
18:07:25 | FromGitter | <awr1> does Porcupine need to build anything separately or can you just import it as a header |
18:08:15 | FromGitter | <eagledot> https://play.nim-lang.org/#ix=2hLg |
18:08:40 | leorize[m] | @eagledot: that is a C idiom for opaque struct |
18:09:03 | leorize[m] | see my example above for how to define it in Nim |
18:09:37 | FromGitter | <awr1> yeah if you wanted a opaque struct that is C-compatible do leorize's thing |
18:10:26 | FromGitter | <awr1> i was confused if you were just writing nim code by itself and wanted to know the equivalent to something from C or actually making bindings to something |
18:12:04 | FromGitter | <eagledot> Now i actually wanted equivalent in NIM ...by reading C header file...they provide dll. β Thanks for the help. i will try your code |
18:13:47 | FromGitter | <eagledot> what does pragma `cdecl` does? |
18:14:20 | FromDiscord | <kodkuce> how do i send file in respons in asnchttpserver |
18:15:54 | FromDiscord | <kodkuce> i read it with streams and just put it as repsons string and add {application type} |
18:16:27 | FromDiscord | <kodkuce> or what |
18:17:15 | FromGitter | <awr1> what is the dll name |
18:18:20 | leorize[m] | @eagledot: it tells Nim to use C calling convention |
18:19:03 | FromGitter | <eagledot> @awr1 `libpv_porcupine.dll` β https://github.com/Picovoice/porcupine/tree/master/lib/windows/amd64 |
18:19:40 | FromGitter | <eagledot> Is it not the default i.e C convention? |
18:20:34 | leorize[m] | yea, the default is Nim calling convention |
18:20:41 | leorize[m] | which differs depends on which OS you're on |
18:21:26 | * | al1ranger quit (Quit: Leaving) |
18:21:35 | FromGitter | <awr1> https://gist.github.com/awr1/d3b7198a0c3941e971e78ff9091ae07f |
18:21:40 | FromGitter | <awr1> this might work |
18:21:49 | FromGitter | <awr1> uhh |
18:21:52 | FromGitter | <awr1> whoops |
18:22:07 | FromGitter | <awr1> fixed it |
18:22:48 | FromGitter | <awr1> i think |
18:22:59 | leorize[m] | https://play.nim-lang.org/#ix=2hLn <- that's a handwritten high-level wrapper |
18:23:01 | FromGitter | <awr1> i didn't test it fwiw but it seems simple |
18:23:25 | FromGitter | <eagledot> @awr1 I am a newbie to nim:) β That is alot for me to undestand ...thanks though :) |
18:23:41 | FromGitter | <awr1> nimterop is an advanced binding generator |
18:23:50 | FromGitter | <awr1> you can install it with `nimble install nimterop` |
18:24:00 | FromGitter | <awr1> then all you do is just import that file |
18:24:04 | FromGitter | <eagledot> is it like c2nim? |
18:24:10 | leorize[m] | it's better :P |
18:24:36 | FromGitter | <awr1> it can use c2nim if you want |
18:25:34 | FromGitter | <awr1> but in general it's very easy to use, is automatic and doesn't require you to have to implement extra steps in your build system |
18:30:07 | FromGitter | <awr1> once you make that, procs like `porcupineInit()` should be available |
18:30:18 | FromGitter | <eagledot> @ leorize[m] In your code your are using `ptr porcupine` while C prototype expects ` struct **`, am i missing something? |
18:31:32 | leorize[m] | https://play.nim-lang.org/#ix=2hLt <- better wrapper that accounts `pv_status_t` |
18:31:43 | leorize[m] | @eagledot: I use `var Porcupine` |
18:31:55 | FromGitter | <eagledot> Should it not be double `pointer.` i.e like `ptr ptr PorcupineObj` |
18:31:59 | leorize[m] | which expands into `var ptr PorcupineObj` |
18:32:24 | leorize[m] | this requires some understanding in C semantics |
18:33:04 | leorize[m] | the generated Nim code will be `ptr ptr PorcupineObj` |
18:33:21 | FromGitter | <eagledot> OK. |
18:34:50 | * | silvernode quit (Ping timeout: 256 seconds) |
18:38:14 | FromGitter | <awr1> also speaking of nimterop, did you read my comments @leorize https://github.com/nimterop/nimterop/issues/177#issuecomment-612507171 |
18:41:56 | Prestige | It appears you can omit pragmas on procs if you forward declare procs with them, is this recommended though? E.g. https://play.nim-lang.org/#ix=2hLw |
18:43:49 | Prestige | I feel like it'd be easier to maintain if it's a proc you're forward declaring, at least |
18:44:28 | Prestige | Also leorize[m] does your plugin have autocomplete for pragmas? |
18:45:15 | leorize[m] | Prestige: typically, I'd avoid forward declaring altogether |
18:45:31 | leorize[m] | and no, I don't autocomplete pragmas or keywords |
18:45:40 | leorize[m] | they are short so I don't really bother |
18:46:18 | FromDiscord | <Varriount> Forward declaring (for now at least) is a necessary inconvenience. |
18:46:21 | Prestige | I have keyword autocompletion set up but nothing for pragmas unfortunately, think it's just useful to prevent typos |
18:46:34 | leorize[m] | my plugin highlights them |
18:46:43 | FromDiscord | <KingDarBoja> I had to use forward declaring in order to keep things consistent with source code |
18:46:44 | leorize[m] | so if you made a typo you will see it :p |
18:46:59 | FromDiscord | <Varriount> Ideally there would be a tool that would create and sync forward declarations with their implementation. |
18:47:03 | Prestige | hm that's nice. What plugin am I using for syntax highlighting... |
18:47:28 | Prestige | ah, zah/nim.vim |
18:47:48 | Prestige | Varriount that would be very nice |
18:47:59 | leorize[m] | zah/nim.vim syntax highlighting is terrible |
18:48:10 | Prestige | Yeah I'm going to try yours for highlighting |
18:48:22 | Prestige | Im just hoping the autocompletion doesn't conflict with coc-nvim |
18:49:28 | leorize[m] | it won't do anything if you don't configure it |
18:49:43 | Prestige | I love it, that's how plugins should be set up by default |
18:49:46 | leorize[m] | I'll see if it's possible to hook this up with coc-nvim |
18:50:07 | Prestige | Which nim.vim was it again? idr your github username |
18:50:39 | leorize[m] | does templating works on coc-nvim with nimlsp (ie showing you the proc prototype as you write your code)? |
18:50:44 | leorize[m] | Prestige: alaviss/nim.nvim |
18:50:46 | Prestige | Yep |
18:50:48 | Prestige | ty leorize[m] |
18:51:51 | leorize[m] | for maximum highlighting, make sure the file you open is saved on the disk :) |
18:51:51 | Prestige | oh that's much better highlighting! |
18:52:17 | leorize[m] | it just have to exists, then I can employ nimsuggest on it :P |
18:53:13 | dadada | PMunch: any tryExtract news? |
18:53:28 | PMunch | dadada, not really |
18:53:35 | PMunch | I've been away at our cabin for easter |
18:53:50 | PMunch | Just got back today :) |
18:54:22 | dadada | PMunch: convenient excuse for burying bodies in the woods :-) |
18:54:55 | Prestige | s/bodies/eggs (nothing to see here FBI) |
18:55:08 | tane | how is one supposed to obtain a "ptr proc(foo,bar)"? (trying to set a callback in the linenoise module) |
18:56:40 | PMunch | The bodies of those who's sticking their nose in the macroutils module where they don't belong |
18:58:19 | dadada | I knew it |
18:58:27 | leorize[m] | Prestige: if it's convenient, can you show me how nimlsp + coc-nvim looks like? :) |
18:59:34 | Prestige | hm sure I'll make a very short video |
18:59:57 | PMunch | coc-nvim? |
19:00:45 | FromGitter | <zetashift> an LSP provider for neovim? |
19:00:55 | FromGitter | <zetashift> and iirc also autocompletion |
19:02:32 | Prestige | Yeah |
19:03:15 | Prestige | https://0x0.st/iQrs.mp4 |
19:03:19 | Prestige | leorize[m]: ^ |
19:05:01 | leorize[m] | nice, can you show how it's like when you're typing parameters? thanks :) |
19:07:35 | Prestige | Hm I don't think I'm getting param autocompletion like I normally do with other languages, I'm just setting the proc signature |
19:08:10 | PMunch | Huh, neat |
19:08:25 | Prestige | s/setting/getting |
19:08:31 | Prestige | My brain is off this morning |
19:09:29 | Prestige | leorize[m]: with other langauges with coc-nvim, I usually am shown the function signature each time I use a comma to start entering the next parameter |
19:09:41 | Prestige | but I guess that's not happening with nim yet |
19:10:11 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzzβ¦) |
19:10:15 | FromDiscord | <KingDarBoja> Anyone said syntax highlighting? |
19:10:18 | leorize[m] | it will once I found the motivation to work on it :P |
19:10:19 | FromDiscord | <KingDarBoja> Been using the vscode-nim extension, is there a different one π |
19:10:28 | * | kiwi_41 joined #nim |
19:10:40 | leorize[m] | use neovim and you'll get first class syntax highlighting :P |
19:10:54 | kiwi_41 | Hi |
19:10:59 | Prestige | I think just has to do with nimlsp features? |
19:11:20 | kiwi_41 | how is embedding smh like Lua to nim program? |
19:11:25 | kiwi_41 | are there any libs for that? |
19:11:29 | PMunch | Might be a missing feature in nimlsp as well |
19:12:00 | leorize[m] | nimlsp still gotta base its feature on nimsuggest :p |
19:12:00 | Prestige | coc-nvim interacts with the lsp so I think it's just that, but it's nbd. nimlsp works really well |
19:12:06 | Prestige | True |
19:12:06 | FromDiscord | <KingDarBoja> Ah Lua, I remember taking free courses on 2D game dev on Lua lol |
19:12:43 | PMunch | leorize[m], indeed, but not everything in nimsuggest is in nimlsp yet |
19:12:54 | PMunch | kiwi_41, depends on what you need |
19:13:08 | leorize[m] | PMunch: the `con` command should get you the function signature for as long as the cursor is inside the function call params |
19:13:52 | kiwi_41 | I guess id like some scripting options for data my nim program will spit out |
19:14:16 | PMunch | Then maybe look into tying NimScript into Nim |
19:14:44 | kiwi_41 | i would prefer smh mainstream like Lua :D |
19:15:12 | leorize[m] | https://github.com/jangko/nimLUA |
19:16:02 | FromDiscord | <KingDarBoja> Nice |
19:16:10 | leorize[m] | PMunch: the only reason why nim.nvim doesn't use nimlsp is because you haven't got it merged into Nim yet :P |
19:16:38 | leorize[m] | and that you haven't cracked semantic highlighting over lsp too :P |
19:16:39 | PMunch | Well, it uses external Nim packages.. |
19:16:54 | PMunch | There is an extension to LSP that does that.. |
19:16:54 | leorize[m] | dr nim uses external packages too :) |
19:17:01 | PMunch | It does? |
19:17:07 | Yardanico | z3 |
19:17:26 | leorize[m] | and zevv's nimz3 wrapper |
19:17:34 | PMunch | Huh, when I decided not to make a PR for nimlsp it was because of external dependencies. But maybe now that the flood gates are open.. |
19:17:38 | * | kiwi_41 quit (Quit: Connection closed) |
19:20:56 | * | lritter joined #nim |
19:29:13 | * | inv2004 joined #nim |
19:30:07 | * | Hexeratops quit (Read error: Connection reset by peer) |
19:32:49 | * | jjido joined #nim |
19:42:10 | Prestige | hm this is interesting: https://nim-by-example.github.io/variables/result/ |
19:42:28 | Prestige | In the 'unexpected' proc, I would expect `result` to be shadowed |
19:43:19 | Prestige | Or is it that, if you shadow `result`, you must explicitly return result? |
20:04:54 | * | blackbeard420 quit (Quit: ZNC 1.7.5 - https://znc.in) |
20:07:29 | FromDiscord | <kodkuce> i got GET part working but hmm how do i upoload a file to asynchttpserver, am trying to net depend on js , so i tryed with plain HTML5 post and <input file but in post req i only see my filename nothing else |
20:09:04 | * | inv2004 quit (Ping timeout: 265 seconds) |
20:10:27 | FromDiscord | <kodkuce> was missing enctype="multipart/form-data" |
20:12:56 | FromDiscord | <Recruit_main707> from the example in here, https://nim-lang.org/docs/macros.html#statements-procedure-declaration the first proc, how would i access that return type? (its the first line inside nnkFormalParams) |
20:13:03 | FromDiscord | <Recruit_main707> (from a macro) |
20:18:24 | * | Vladar quit (Quit: Leaving) |
20:22:57 | FromDiscord | <kodkuce> now i think i know why jester exists cuz i need a parser for POST body request |
20:34:48 | FromDiscord | <kodkuce> there is no multipart parser Nim lib right?, meybe i can use some C lib https://github.com/twTwo/multipart-parser-c |
20:37:25 | leorize[m] | Prestige: yea, result was shadowed, but the special result is the one that's returned |
20:37:53 | leorize[m] | @kodkuce: or you can just import only the multipart parser... |
20:38:54 | FromDiscord | <kodkuce> from whee i think jester has some |
20:39:14 | leorize[m] | https://github.com/dom96/jester/blob/b68c1a88612b0dae319be03caaac430b18905adf/jester/private/utils.nim#L55 |
20:39:17 | * | chemist69 quit (Ping timeout: 246 seconds) |
20:40:22 | * | chemist69 joined #nim |
20:40:56 | FromDiscord | <kodkuce> how can i import only part of jester, like form jester import multypart ? |
20:41:20 | FromDiscord | <kodkuce> tough from what i see its utils in jester |
20:42:04 | PMunch | import jester/utils? |
20:43:14 | Prestige | leorize[m]: ah, that's interesting |
20:44:12 | Prestige | from jester import util looks correct to me, is that not working? |
20:45:18 | Prestige | utils* |
20:45:33 | FromDiscord | <kodkuce> /home/me/Documents/Projects/Nim/SimpleHTTPupload/simpleserver.nim(9, 14) Error: cannot open file: jester/utils |
20:46:38 | FromDiscord | <kodkuce> /home/me/Documents/Projects/Nim/SimpleHTTPupload/simpleserver.nim(9, 20) Error: undeclared identifier: 'utils' |
20:48:43 | FromDiscord | <kodkuce> hmm i need to rip just filedata from that whole body so i can save it on my server |
20:48:45 | FromDiscord | <kodkuce> dooom |
20:50:23 | FromDiscord | <kodkuce> import jester/private/utils << this worked |
21:04:02 | * | audiofile joined #nim |
21:04:03 | audiofile | guys |
21:04:09 | audiofile | nim sounds like a dream come true |
21:04:21 | PMunch | Preaching to the choir in here :) |
21:04:23 | audiofile | recommended resource to learn this language? |
21:04:33 | audiofile | I mean, I just checked out the features tab and I'm already sold |
21:04:36 | audiofile | yeah :P PMunch |
21:05:20 | FromDiscord | <Recruit_main707> audiofile, sadly, almsot no tutorials out there out of the very basic stuff |
21:05:27 | PMunch | Prestige, the `from X import Y` means that you want to import the procedure or variable Y from the module X. `import X/Y` means you want to import the module Y in subfolder X |
21:05:44 | audiofile | ah I see... have to noodle around myself to get past the beginner stage I see |
21:05:45 | PMunch | Recruit_main707? Really what are you missing? |
21:05:55 | audiofile | but from first glance, nim seems VERY versatile |
21:06:11 | Prestige | ah thanks PMunch |
21:06:23 | FromDiscord | <Recruit_main707> PMunch, metaprogramming tutorials get reduced to literally the docs :p |
21:06:39 | FromDiscord | <KingDarBoja> I wish Jetbrains will release some plugin for Nim or a fully IDE like PyCharm |
21:06:58 | PMunch | Recruit_main707, this might be useful for you: https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html |
21:07:04 | PMunch | I basically walk through how I create my macros |
21:09:28 | FromDiscord | <Recruit_main707> PMunch: great page, i have a macros problam though, could you help me? |
21:09:32 | * | audiophile joined #nim |
21:09:32 | * | audiophile is now known as videofile |
21:09:34 | FromDiscord | <Recruit_main707> it should not be very hard |
21:09:38 | * | videofile quit (Changing host) |
21:09:38 | * | videofile joined #nim |
21:09:55 | PMunch | Sure |
21:09:57 | PMunch | Ask away |
21:10:27 | videofile | do you write a lot about nim? |
21:10:36 | * | audiofile quit (Ping timeout: 256 seconds) |
21:10:40 | PMunch | Me? |
21:10:44 | videofile | yessir |
21:10:55 | PMunch | Well, pretty much everything on that site is about Nim :P |
21:11:15 | videofile | oh I could find only 6 entires under nim tag. will try homepage then |
21:11:17 | PMunch | But I'm not sure you'd consider that much.. |
21:11:43 | FromDiscord | <Recruit_main707> PMunch: https://nim-lang.org/docs/macros.html#statements-procedure-declaration the first proc, how would i access that return type? (its the first line inside nnkFormalParams) |
21:11:43 | FromDiscord | <Recruit_main707> (from a macro) |
21:11:47 | videofile | sorry, missed the older entries button |
21:12:14 | PMunch | Haha, yeah that button could be more obvious.. |
21:13:03 | PMunch | myProcDef[3][0] |
21:13:06 | leorize[m] | @Recruit_main707: `[0]` |
21:13:14 | videofile | anyway I can submit corrections/typos on a post? |
21:13:21 | FromDiscord | <Recruit_main707> thats a bit ugly isnt it? |
21:13:25 | PMunch | videofile, sure |
21:13:37 | PMunch | Recruit_main707, yes |
21:13:38 | leorize[m] | that's where @PMunch macroutils comes in :P |
21:13:42 | PMunch | Hence why I wrote macroutils :) |
21:14:21 | leorize[m] | you can actually do this: `procDef.params[0]` with only `macros` right now |
21:14:54 | FromDiscord | <Recruit_main707> but the AST will always look the same right? |
21:15:43 | FromDiscord | <Recruit_main707> (ie: FormalParams will always be at that position) |
21:16:14 | PMunch | Yes |
21:18:01 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzzβ¦) |
21:22:55 | * | inv2004 joined #nim |
21:24:22 | FromGitter | <zacharycarter> shashlik: np |
21:25:14 | * | solitudesf quit (Ping timeout: 240 seconds) |
21:25:34 | videofile | nim hit 1.0 right? I think I saw a hn post |
21:25:52 | PMunch | Yes, quite a while back |
21:25:56 | PMunch | We're on 1.2 now |
21:26:03 | videofile | sweeet! |
21:26:22 | videofile | so will there be any breaking changes expected like from python2 to 3? |
21:26:26 | videofile | or backward compat |
21:26:35 | videofile | i assume 1.0 means the latter |
21:27:31 | videofile | wow you can use different GCs??? |
21:27:34 | videofile | craycray! |
21:27:43 | FromDiscord | <Recruit_main707> and the new arc! |
21:27:50 | videofile | arc?? |
21:27:53 | videofile | I'll have to look that up |
21:28:16 | FromDiscord | <Recruit_main707> automatic reference counting https://docs.elementscompiler.com/Concepts/ARCvsGC/ |
21:28:35 | FromDiscord | <Recruit_main707> ^ this is not nim specific |
21:28:43 | PMunch | Well, breaking changes for 2.0 |
21:29:34 | videofile | does retain cycle mean stuff referencing each other, possibly not getting removed from memory? |
21:30:03 | FromDiscord | <Recruit_main707> i think, i know almost nothing about gcs |
21:30:31 | videofile | im a python refugee and can tell you that metaprogramming in python sucks |
21:31:05 | videofile | there is the ast package but it is really unwieldy |
21:31:19 | * | Northstrider joined #nim |
21:32:22 | PMunch | And it's runtime |
21:32:23 | Northstrider | Hey. I see csources has not been updated for quite a while, how's it able to build the most recent compilers? |
21:32:26 | PMunch | Where's the fun in that! |
21:32:35 | * | Hexeratops joined #nim |
21:32:36 | videofile | exactly!!! |
21:32:44 | PMunch | Northstrider, well it understands the subset of Nim that the compiler uses |
21:32:54 | PMunch | I mean it doesn't use every single feature |
21:33:12 | Northstrider | Ah okay |
21:33:31 | Northstrider | So if the compiler/stdlib used new constructs, csources would also be updated? |
21:33:51 | videofile | the style insensitivity seems...odd coming from other languages |
21:33:58 | videofile | is nim the first to do this |
21:34:08 | PMunch | Northstrider, probably yeah |
21:34:13 | PMunch | Well I mean, they'd have to |
21:34:14 | Northstrider | Makes sense, thanks |
21:34:18 | PMunch | videofile, don't worry about it |
21:34:33 | videofile | i dont think ill lose any sleep over it :P |
21:34:36 | PMunch | It's a great feature once you get used to it (ie. realise that you don't actually ever think about it) |
21:34:53 | videofile | i just need to find a vim plugin for nim :/ |
21:34:57 | PMunch | And I don't think Nim is the first to do it |
21:35:01 | PMunch | videofile, which editor? |
21:35:01 | videofile | oh |
21:35:09 | videofile | vim PMunch |
21:35:14 | videofile | and what language was it? just curious |
21:35:32 | Northstrider | Also, where would I find the first version of the c compiler capable of building the first nim compiler that could self host? i.e. the point where the c compiler didn't need to be used anymore. 1_1 in csources is auto generated from what I can see |
21:35:38 | PMunch | I use this: https://github.com/zah/nim.vim along with nimlsp |
21:36:06 | videofile | oh second one is by a certain PMunch? :D |
21:36:16 | PMunch | Haha, yes :P |
21:36:26 | videofile | niiice, thanks for doing that |
21:36:34 | dadada | videofile: https://totallywearingpants.com/posts/nim-language-highlights/ |
21:36:39 | PMunch | No problem, after all I'm using it myself :P |
21:36:46 | dadada | videofile: also use play.nim-lang.org |
21:36:48 | PMunch | Northstrider, the first C compiler? |
21:37:04 | videofile | is there a nim-offtopic? Id like to ask some q's about hwo you went about writing the lsp |
21:37:12 | Northstrider | PMunch: Oh, was nim not bootstrapped in C? |
21:37:17 | videofile | thanks dadada! |
21:37:37 | PMunch | videofile, yes there is |
21:37:51 | PMunch | Northstrider, I think the first compiler was written in Pascal IIRC |
21:37:59 | PMunch | But you'd have to ask Araq about that |
21:38:48 | Northstrider | https://github.com/nim-lang/Nim/blob/a03d8ed4c20b3ee2ae40b1c547cfbdb8738c27b5/compiler/readme.txt#L2 |
21:39:05 | dadada | Northstrider: it's written in Nim's sources that Nim was originally developed in Pascal and that code was rewritten to Nim |
21:39:08 | Northstrider | bootstrapped in pascal, you are right :) |
21:40:07 | * | blackbeard420 joined #nim |
21:40:36 | * | SenasOzys joined #nim |
21:41:50 | PMunch | If you squint and tilt your head you can still see some Pascal in Nim |
21:42:04 | * | hpyc9 quit (Quit: ZNC 1.7.5 - https://znc.in) |
21:42:04 | * | blackbeard420 quit (Client Quit) |
21:42:07 | videofile | is pointer arithmetic totally not possible ? |
21:42:24 | PMunch | It is? |
21:42:30 | PMunch | Why would it be impossible? |
21:42:35 | videofile | idk :/ just asking |
21:42:43 | PMunch | Just cast the pointer to an int and you can do whatever with it |
21:42:57 | videofile | ohh right |
21:43:43 | * | blackbeard420 joined #nim |
21:44:12 | * | hpyc9 joined #nim |
21:44:28 | videofile | someone throw me the discord invite pls |
21:45:11 | Northstrider | There's probably no simple answer to this, but why target c rather than llvm IR? |
21:45:31 | PMunch | Because LLVM wasn't really stable or well known at the time |
21:45:43 | FromDiscord | <Recruit_main707> llvm was not looking so promising bacj then |
21:45:48 | FromDiscord | <Recruit_main707> how do you represent an Integrer as a NimNode? |
21:45:55 | PMunch | And in retrospect I'm glad Nim chose C, makes things like interacting with C and reusing libraries a breeze |
21:46:05 | FromDiscord | <Recruit_main707> "breeze" |
21:46:06 | Northstrider | Ah fair, thanks :) |
21:46:09 | PMunch | And it can run anywhere C can, even on microcontrollers |
21:46:20 | FromDiscord | <Recruit_main707> thats true |
21:46:24 | PMunch | Recruit_main707, IntLit? |
21:46:26 | Northstrider | videofile: https://discordapp.com/invite/ezDFDw2 |
21:46:27 | videofile | true, and you can't really argue with the fact that it makes it really easy for systems stuff |
21:46:29 | videofile | ty |
21:46:44 | FromDiscord | <MapleSyrup> eyy |
21:47:57 | FromDiscord | <Recruit_main707> PMuch: but thats a nimNodeKind |
21:48:15 | FromDiscord | <Recruit_main707> id need a NimNode |
21:48:34 | dadada | Northstrider: C is probably the most portable target currently in existence, there're C compilers for all platforms, also with C as a target Nim isn't depenend on llvm, it effectively can be compiled by clang (llvm) or gcc and many other c compilers, also the performance of C compilers is extremely good, I doubt there would be significant performance gains by switching to llvm-IR |
21:49:13 | PMunch | Recruit_main707, newLit(100)? |
21:49:58 | dadada | Northstrider: additional reason is that it's allowing for mixing C/C++ code with Nim code for better interop |
21:51:20 | dadada | Northstrider: one more thing that comes to mind is, that it's probably easier for developers to debug the generated C code (since so many devs are familiar with C) as opposed to debugging llvm-IR |
21:52:23 | * | pbb joined #nim |
21:57:24 | FromDiscord | <Asmodeus> Those are good points, thank you dadada |
21:58:00 | videofile | please dont crucify me but are there any linters for nim that make it conform to a specific case sensitivity? |
21:59:27 | dadada | Zevv: very well written! keep doing that, cause I think it makes a huge difference to have such quality content! http://zevv.nl/nim-memory |
22:00:53 | * | tane quit (Quit: Leaving) |
22:01:06 | FromDiscord | <Recruit_main707> videofile, i dont thinkso |
22:01:17 | videofile | wow yall are single-handedly pumping out a lot of resources for nim literature |
22:01:34 | * | liblq-dev quit (Quit: WeeChat 2.7.1) |
22:01:43 | PMunch | Well there's this: https://github.com/FedericoCeratto/nimfmt |
22:02:24 | PMunch | videofile, well, it's not single-handedly when we're multiple people is it? |
22:02:34 | videofile | this irc |
22:02:41 | PMunch | There's also nimpretty I think |
22:06:17 | * | SenasOzys quit (Quit: Leaving) |
22:07:38 | Prestige | nimfmt looks decent |
22:08:03 | Prestige | interesting to see ; as proc param separators though, thought , was the norm |
22:08:23 | Yardanico | it still can be used |
22:10:02 | PMunch | Yeah, you can do , or ; |
22:10:07 | PMunch | But there are some differences |
22:10:27 | PMunch | proc (x, y: int) for example |
22:10:54 | * | inv2004 quit (Ping timeout: 256 seconds) |
22:10:55 | Prestige | if you used a ; there it would fail to compile right? |
22:11:00 | Yardanico | yes |
22:11:06 | Yardanico | but ; actually has places where it's useful IIRC |
22:11:15 | Yardanico | although that has to do with some pragmas and advanced features |
22:11:33 | Yardanico | don't remember where though :P |
22:11:58 | Prestige | only thing I've seen so far is when you have extra parens and you need to use ; to separate statements |
22:12:26 | Yardanico | no, I mean ; in arg list |
22:12:56 | Prestige | ah |
22:13:36 | Yardanico | well, I think I remember at least one such case - templates |
22:13:50 | Yardanico | template test (something; data: string) = stuff |
22:26:29 | videofile | anyone willing to share nim hobby projects on github? |
22:26:35 | videofile | wanna see if I can 'read' it |
22:29:46 | FromDiscord | <Recruit_main707> I have a rocket league example bot made in Nim, sadly, since we don't have official support for Nim (working on it), it uses a python bridge that sends all the game data to nim and receives the game inputs. |
22:30:12 | FromDiscord | <Recruit_main707> It's outdated, and it won't work with arc though |
22:30:28 | Yardanico | videofile: https://github.com/Yardanico/nim-mathexpr :P |
22:31:02 | Prestige | Anyone have resources for learning xlib? I'm wanting to write a window manager in nim |
22:31:08 | Yardanico | also https://github.com/Yardanico/nim-adb |
22:31:20 | Yardanico | Prestige: don't know resources but a few people did some simple WMs in nim |
22:31:31 | videofile | wow impressive |
22:31:38 | Yardanico | Prestige: https://github.com/search?q=language%3Anim+wm |
22:31:48 | Prestige | I've been looking at one, but am not sure what some of the imported types are |
22:32:23 | PMunch | https://peterme.net/tinywm-implementation-in-nim.html |
22:33:09 | PMunch | I'm working on a Nim WM as well |
22:33:27 | Prestige | Oh that's great |
22:35:40 | Prestige | I haven't work with anything low-level before, not sure where to begin understanding xlib. Just reading through code trying to wrap my ahead around the variables, determining what they are |
22:38:09 | * | Hexeratops quit (Read error: Connection reset by peer) |
22:39:13 | videofile | just curious, why is mixing tabs and spaces a big deal when compiler can replace tabs with spaces? asking as a layman |
22:40:00 | PMunch | Because you have no idea how many spaces a tab is meant to be |
22:40:28 | PMunch | Prestige, abandon all hope ye who enters here |
22:40:45 | Prestige | isn't that a line from xterm? Lol |
22:41:03 | Yardanico | Prestige: it's nuch older :P |
22:41:18 | Yardanico | https://en.wiktionary.org/wiki/abandon_hope_all_ye_who_enter_here |
22:41:31 | PMunch | Supposedly inscribed at the entrance to hell |
22:41:35 | Prestige | Yeah was just thinking in terms of applications |
22:42:19 | Prestige | I found an overview for xlib.. going to be a lot more reading before writing code I support |
22:42:21 | Prestige | suppose * |
22:42:53 | videofile | ok |
22:43:02 | videofile | It's going to be hard but vim's expandtab saves the day |
22:43:33 | PMunch | Haha, yeah no-one actually hits space twice |
22:43:45 | videofile | ;) |
22:43:49 | videofile | unless youre a cat |
22:43:50 | PMunch | Prestige, it's not toohard |
22:44:57 | Prestige | Just some info I'll need to know beforehand - I have a wm I've adapted written in c that I want to convert to nim, but I think it's overly complex for what I want anyway |
22:45:49 | * | pbb quit (Read error: Connection reset by peer) |
22:47:04 | * | pbb joined #nim |
22:51:05 | * | Trustable quit (Remote host closed the connection) |
22:51:27 | * | exelotl quit (Quit: Leaving) |
22:56:23 | videofile | how nim handle unicode |
22:56:42 | videofile | oof got it |
22:56:43 | videofile | sorry |
22:58:42 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hN1 |
22:58:59 | FromDiscord | <KingDarBoja> Careful with how Nim handles unicode and characters, this ain't Python :S |
22:59:19 | FromDiscord | <KingDarBoja> By the way, why initTable provides that ton of fields? |
23:03:14 | videofile | ooh thanks |
23:04:36 | FromDiscord | <KingDarBoja> Are you newbie videofile? |
23:04:46 | FromDiscord | <KingDarBoja> Do you come from Python? |
23:04:48 | videofile | yeeeeees |
23:04:54 | FromDiscord | <KingDarBoja> Hold on, |
23:04:55 | videofile | yes ot both |
23:05:00 | videofile | you have osmething for me |
23:05:07 | videofile | a sidequest perhaps? |
23:07:11 | FromDiscord | <KingDarBoja> I will share the npte I got from Variount explaining the difference |
23:07:14 | FromDiscord | <KingDarBoja> Note* |
23:07:52 | FromDiscord | <KingDarBoja> Oh right, you are on IRC |
23:08:01 | FromDiscord | <KingDarBoja> A character is an abstract representation of a piece of text, separate from encoding. |
23:08:04 | FromDiscord | <KingDarBoja> A char is a data type, usually composed of 8 bytes. |
23:08:11 | FromDiscord | <KingDarBoja> When you use stringVar[i] in Nim, you are saying, "give me the i'th char in the string" |
23:08:18 | FromDiscord | <KingDarBoja> When you use unicode.runAtPos(stringVar, i), you are saying, "give me the i'th utf-8 character in the string" |
23:09:58 | FromDiscord | <KingDarBoja> So be careful as Python pretty much handles all that by using unicode everywhere |
23:10:07 | FromGitter | <awr1> if you want to use string-to-string tables |
23:10:16 | FromGitter | <awr1> might i recommend https://nim-lang.org/docs/strtabs.html |
23:10:31 | * | PMunch quit (Quit: leaving) |
23:11:09 | FromDiscord | <KingDarBoja> Let me see |
23:11:52 | videofile | im on discord too |
23:12:05 | FromDiscord | <MapleSyrup> hey @KingDarBoja |
23:12:13 | FromDiscord | <MapleSyrup> tis me |
23:12:16 | FromDiscord | <KingDarBoja> Hey! |
23:12:44 | FromDiscord | <MapleSyrup> ah just aw your explanation |
23:12:57 | FromDiscord | <KingDarBoja> I sent the entire text block on DM |
23:13:16 | FromDiscord | <KingDarBoja> It was the explanation that @Varriount gave to me as I asked the same stuff |
23:15:41 | * | Hexeratops joined #nim |
23:17:46 | FromDiscord | <KingDarBoja> awr1: should I be worried of the repr table fields? |
23:17:47 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hNa |
23:22:03 | * | opal quit (Ping timeout: 240 seconds) |
23:23:28 | * | opal joined #nim |
23:27:12 | leorize[m] | Recruit_main707: that's not what ARC mean btw |
23:27:18 | leorize[m] | though the idea is similar |
23:28:00 | FromDiscord | <KingDarBoja> Hi there leorize, my comrade! |
23:28:04 | leorize[m] | the "official" name is Araq's Reference Counting lol |
23:28:57 | leorize[m] | o/ @KingDarBoja |
23:29:12 | * | dwdv quit (Ping timeout: 258 seconds) |
23:30:56 | FromDiscord | <KingDarBoja> Juts looking right now at the repr on Table |
23:31:07 | FromDiscord | <KingDarBoja> I see several Fields* |
23:32:13 | FromDiscord | <Gary M> I'm on Windows trying to use nimterop but in getHeader I'm getting a configure capable but bash executable missing error |
23:33:18 | leorize[m] | @KingDarBoja viewing a table with `repr` will spill all of it's internals out |
23:33:38 | leorize[m] | you should use `$` for them |
23:33:48 | leorize[m] | shashlick: see Gary M message |
23:35:27 | FromDiscord | <KingDarBoja> Thank you Leo, added to my notes π |
23:52:22 | * | inv2004 joined #nim |