Nim Internals

4294 Members
14 Servers

Load older messages

22 Sep 2023
@_discord_524288464422830095:t2bot.iochronos.vitaqua Modernized as in using methods instead of StreamObj and making a ref of it? 17:53:57
@_discord_249832070413680640:t2bot.ioJonathan joined the room.19:20:20
@_discord_440903545903120384:t2bot.ion7itro joined the room.21:26:00
@_discord_1151297532249522267:t2bot.iocubyt3 joined the room.23:50:36
23 Sep 2023
@_discord_733059160924749855:t2bot.ioraynei486 the way it currently does inheritance makes it a pain to rewrite with destructors 01:15:17
@_discord_691162904938151946:t2bot.iowazzapazza#0 changed their display name from wazzapazza to wazzapazza#0.01:29:36
@_discord_952570072017276968:t2bot.ioackahpauloaw63 joined the room.01:34:04
@_discord_1155063748193693696:t2bot.iozealous_beagle_48090 joined the room.08:51:59
@_discord_524288464422830095:t2bot.iochronos.vitaqua So I'd assume methods could help? Or am I mistaken 11:39:15
@_discord_1016751437499355277:t2bot.iosichelmondprinz#0 changed their display name from eventidegays to sichelmondprinz#0.13:01:21
@_discord_1016751437499355277:t2bot.iosichelmondprinz#0 changed their profile picture.13:01:29
@_discord_711169405681270805:t2bot.ioLePichu#7464 changed their profile picture.13:25:31
@_discord_523568003712024586:t2bot.ionima262 joined the room.13:39:45
@_discord_252829242616709121:t2bot.ioack.tax#0 changed their display name from syntax.w#0 to ack.tax#0.14:20:17
@_discord_138988491240505345:t2bot.iosirolaf#0 Is there an easy conversion from openArray[byte] to openArray[char]? The checksums package uses openArray[char] which is pretty inconvenient when dealing with binary data because from what I understand seq[byte] should be preferred over string for that 14:43:36
@_discord_138988491240505345:t2bot.iosirolaf#0 I assume there isn't an acceptable way like for toOpenArrayByte so I'd like to ask if that should be added in that case 14:46:44
@_discord_150345911057252352:t2bot.iovindaar just cast it, no? They are identical memory wise after all 14:48:09
@_discord_138988491240505345:t2bot.iosirolaf#0 It's a magic type so can't cast it 14:49:37
@_discord_138988491240505345:t2bot.iosirolaf#0 I guess you can by turning it into ptr openArray though 14:50:07
@_discord_138988491240505345:t2bot.iosirolaf#0 Nope causes an internal errror 14:51:03
@_discord_138988491240505345:t2bot.iosirolaf#0 * Nope causes an internal error 14:51:06
@_discord_150345911057252352:t2bot.iovindaar Ah, you're right. I blanked out about you asking for openArray. In that case just go via a ptr UncheckedArray[char] middle step 14:53:29
let s = "hello"
let b = cast[ptr UncheckedArray[byte]](s[0].addr)

proc foo(x: openArray[char]) =

template toOpenArrayChar(x: openArray[byte]): untyped =
  let b = cast[ptr UncheckedArray[char]](x[0].addr)
  toOpenArray(b, 0, x.len)

foo(toOpenArrayChar(toOpenArray(b, 0, s.len)))

is what I mean. If you already have an openArray[byte] the inner toOpenArray of course is not needed
@_discord_138988491240505345:t2bot.iosirolaf#0 That works for now, thanks 👍 14:56:44
@_discord_138988491240505345:t2bot.iosirolaf#0 Still think something like that should be in stdlib though, very offputting to have to cast this "safe" construct around 14:57:40
@_discord_250322741406859265:t2bot.iokatlyn#0 changed their profile picture.18:58:56
@_discord_392304545016971264:t2bot.ioDARKMATTER joined the room.20:35:26
@_discord_1154428330590875678:t2bot.iofxdazz joined the room.21:04:34
@_discord_1146232943690387579:t2bot.io.xnsy joined the room.21:49:22
24 Sep 2023
@_discord_593294576026910720:t2bot.iosaiiiniii#0 changed their profile picture.04:07:05

There are no newer messages yet.

Back to Room ListRoom Version: 6