!EtGqjSRNQoJCbpCJSF:matrix.org

Nim programming language

3141 Members
Official Matrix channel for the Nim programming language. This channel is bridged with our main Discord and Gitter channels.45 Servers

Load older messages


SenderMessageTime
26 Jun 2022
@_discord_180601887916163073:t2bot.ioIsofruit#5120 Other than that, there's wiki pages detailing comparisons between nim and python/c:
https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers
https://github.com/nim-lang/Nim/wiki/Nim-for-C-programmers
16:54:33
@_discord_527155716469817364:t2bot.ioܕܵܢ changed their display name from Izazo M. Squoze to ܕܵܢ#8554.17:24:32
@_discord_527155716469817364:t2bot.ioܕܵܢ changed their profile picture.17:24:40
@_discord_527155716469817364:t2bot.ioܕܵܢ changed their display name from ܕܵܢ#8554 to ܕܵܢ.17:24:44
@_discord_768775480168939521:t2bot.iodeadmeme77 Ah, this is an important concept that I need to get, I guess 19:10:23
@_discord_768775480168939521:t2bot.iodeadmeme77 "In C, there's nothing that stops you from keeping a pointer to a stack-allocated array after the function that declared it has returned (and the stack is invalidated). In Nim, this is true as well, but you are strongly discouraged from using pointers in Nim, and you can accomplish almost everything you'd otherwise use pointers for with normal arguments, "var" arguments, variables, and "ref"." 19:10:25
@_discord_768775480168939521:t2bot.iodeadmeme77 so in C codes that use pointers, I should check whether to replace them with normal arguments, or references 19:11:05
@elegantbeef:matrix.orgElegantbeef
In reply to @_discord_705152179782025308:t2bot.io
Why does overloading is work inside the file where its defined, but not in another file where it gets imported?
Given the purpose of is overriding it is suspect at best
20:28:26
@elegantbeef:matrix.orgElegantbeef is is meant to be used for compile time type checking for generics and similar, overriding it does not make any sense to me 20:29:53
@elegantbeef:matrix.orgElegantbeef
In reply to @_discord_768775480168939521:t2bot.io
so in C codes that use pointers, I should check whether to replace them with normal arguments, or references
Yep the best Nim code uses ptrs only where they're absolutely needed(typically with C interop) otherwise you use safer tools
20:30:51
@_discord_709044657232936960_void09=5b=49=52=43=5d:t2bot.iovoid09[IRC]#0000 joined the room.21:50:53
@_discord_709044657232936960_void09=5b=49=52=43=5d:t2bot.iovoid09[IRC]#0000 whoami 21:50:54
@voidwalker09:matrix.orgvoidwalker09 joined the room.21:51:32
@voidwalker09:matrix.orgvoidwalker09sorry21:52:35
@_discord_288750616510201856:t2bot.iodemotomohiro If you are using pointer or addr but not using C library/API, you are very likely doing something wrong. 22:33:03
@_discord_762008715162419261:t2bot.ioPatitotective why do enums and object collide? shouldn't i just have to write MyEnum.MyObj to refer to the enum?
type
  MyEnum = enum
    MyObj
  
  MyObj = object
    x, y: int
23:18:02
@elegantbeef:matrix.orgElegantbeef You can annotate the enum with {.pure.} or use overloadableEnums 23:20:43
@_discord_288750616510201856:t2bot.iodemotomohiro For example:
type
  MyEnum {.pure.} = enum
    MyObj
  
  MyObj = object
    x, y: int
23:21:14
@elegantbeef:matrix.orgElegantbeefHaving a type named the same as an enum field is bad practice anyway23:22:08
@elegantbeef:matrix.orgElegantbeefOverloadable enums doesnt solve the problem though23:23:22
@elegantbeef:matrix.orgElegantbeefThought it would, but it doesnt23:23:29
@_discord_762008715162419261:t2bot.ioPatitotective im translating some cpp code to nim (3k lines 😭 ) so i guess i'll reconsider all names when i get it working ;] 23:23:47
@elegantbeef:matrix.orgElegantbeefWhat're you translating?23:24:05
@_discord_762008715162419261:t2bot.ioPatitotective https://github.com/BalazsJako/ImGuiColorTextEdit 😶 23:24:50
@elegantbeef:matrix.orgElegantbeef You do realize the .h file is only 300 loc right? 23:27:02
@_discord_762008715162419261:t2bot.ioPatitotective yeaaa but i dont want to wrap it 23:27:44
@elegantbeef:matrix.orgElegantbeefThen have fun23:27:55
@_discord_762008715162419261:t2bot.ioPatitotective and i dont know how to compile it either 23:28:03
@_discord_762008715162419261:t2bot.ioPatitotective :/ 23:28:07
27 Jun 2022
@_discord_709044657232936960_=4eim=45venter=5b=49=52=43=5d:t2bot.ioNimEventer[IRC]#0000 New thread by Treeform: Nim 2.0 is already here., see https://forum.nim-lang.org/t/9266 00:00:55

There are no newer messages yet.


Back to Room List