22 Sep 2023 |
chronos.vitaqua | Modernized as in using method s instead of StreamObj and making a ref of it? | 17:53:57 |
| Jonathan joined the room. | 19:20:20 |
| n7itro joined the room. | 21:26:00 |
| cubyt3 joined the room. | 23:50:36 |
23 Sep 2023 |
raynei486 | the way it currently does inheritance makes it a pain to rewrite with destructors | 01:15:17 |
| wazzapazza#0 changed their display name from wazzapazza to wazzapazza#0. | 01:29:36 |
| ackahpauloaw63 joined the room. | 01:34:04 |
| zealous_beagle_48090 joined the room. | 08:51:59 |
chronos.vitaqua | So I'd assume methods could help? Or am I mistaken | 11:39:15 |
| sichelmondprinz#0 changed their display name from eventidegays to sichelmondprinz#0. | 13:01:21 |
| sichelmondprinz#0 changed their profile picture. | 13:01:29 |
| LePichu#7464 changed their profile picture. | 13:25:31 |
| nima262 joined the room. | 13:39:45 |
| ack.tax#0 changed their display name from syntax.w#0 to ack.tax#0. | 14:20:17 |
sirolaf#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 |
sirolaf#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 |
vindaar | just cast it, no? They are identical memory wise after all | 14:48:09 |
sirolaf#0 | It's a magic type so can't cast it | 14:49:37 |
sirolaf#0 | I guess you can by turning it into ptr openArray though | 14:50:07 |
sirolaf#0 | Nope causes an internal errror | 14:51:03 |
sirolaf#0 | * Nope causes an internal error | 14:51:06 |
vindaar | 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 |
vindaar | let s = "hello"
let b = cast[ptr UncheckedArray[byte]](s[0].addr)
proc foo(x: openArray[char]) =
discard
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 | 14:55:51 |
sirolaf#0 | That works for now, thanks 👍 | 14:56:44 |
sirolaf#0 | Still think something like that should be in stdlib though, very offputting to have to cast this "safe" construct around | 14:57:40 |
| katlyn#0 changed their profile picture. | 18:58:56 |
| DARKMATTER joined the room. | 20:35:26 |
| fxdazz joined the room. | 21:04:34 |
| .xnsy joined the room. | 21:49:22 |
24 Sep 2023 |
| saiiiniii#0 changed their profile picture. | 04:07:05 |