Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 04 2021 12:26
    @dom96 banned @acroobat
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
Elegantbeef
@elegantbeef:matrix.org
[m]
It's a struct or record
I think pascal calls them records
voidwalker#1983
@_discord_323176231098908672:t2bot.io
[m]
I mean foo with ()
what does the () do ?
Elegantbeef
@elegantbeef:matrix.org
[m]
It's an object constructor which creates a 0'd Foo
Foo() == Foo(a1: 0, a2: 0, a0: 0, a3: 0, a4: 0)
voidwalker#1983
@_discord_323176231098908672:t2bot.io
[m]
Oh so it's a var, that's why it works..
Elegantbeef
@elegantbeef:matrix.org
[m]
It's not a var
It's an object constructor, it's actually a constant
voidwalker#1983
@_discord_323176231098908672:t2bot.io
[m]
Right, that's what I meant, var as in not a type def but its instantiation
voidwalker#1983
@_discord_323176231098908672:t2bot.io
[m]
It seems it has a problem with DateTime types in objects, i get a compile error if my object has that and i try to jsonify like in the code above
Elegantbeef
@elegantbeef:matrix.org
[m]
Yes it has procs those cannot easily be json'd
Consider using jsonutils and writing your own hook
voidwalker#1983
@_discord_323176231098908672:t2bot.io
[m]
I will, when I get older : P
demotomohiro#9262
@_discord_288750616510201856:t2bot.io
[m]
type
  BaseObj = object of RootObj
    x: int

  InheritObj = object of BaseObj
    y: string

var
  a = InheritObj(x: 7)
  b: BaseObj = a
echo a, b
This code raise "Error: unhandled exception: invalid object assignment [ObjectAssignmentDefect]".
But it doesn't raise when it is compiled with --mm:orc or --mm:arc.
When --mm:orc is used, copying to BaseObj is no longer runtime error?
Elegantbeef
@elegantbeef:matrix.org
[m]
They use different object type comparisons so one of them is a bug
demotomohiro#9262
@_discord_288750616510201856:t2bot.io
[m]
It is because when --mm:orc is used, runtime check is not implemented?
Elegantbeef
@elegantbeef:matrix.org
[m]
No they're implemented they just behave differently for some types
tinkerbaj#7888
@_discord_966810222855327766:t2bot.io
[m]
Every day I checking this programming language and slowly falling in love. But I really scare that I cant find libraries I use all the time. Can someone tell me what is best discord api for nim.
discord bot api I hope u understand what I mean
Elegantbeef
@elegantbeef:matrix.org
[m]
dimscord i think is the one that most use
tinkerbaj#7888
@_discord_966810222855327766:t2bot.io
[m]
Oh ok
Is there any simple way to find libraries for nim
Elegantbeef
@elegantbeef:matrix.org
[m]
tinkerbaj#7888
@_discord_966810222855327766:t2bot.io
[m]
Exactly what I looking for
Excellent
Elegantbeef
@elegantbeef:matrix.org
[m]
you can also search github with language: Nim
tinkerbaj#7888
@_discord_966810222855327766:t2bot.io
[m]
I low to make for my personal use cli apps
For now nim is like most beautiful and elegant language
I ever use
Patitotective#0127
@_discord_762008715162419261:t2bot.io
[m]
to delete all elements from a seq, do i mySeq.setLen(0)?
Elegantbeef
@elegantbeef:matrix.org
[m]
It doesnt free the memory but it resets the len
Patitotective#0127
@_discord_762008715162419261:t2bot.io
[m]
then mySeq.delete(0, mySeq.high)?
Elegantbeef
@elegantbeef:matrix.org
[m]
no
If you want to free the memory you do = @[]
Patitotective#0127
@_discord_762008715162419261:t2bot.io
[m]
;[
another SmartBeef moment
demotomohiro#9262
@_discord_288750616510201856:t2bot.io
[m]
1 reply
Patitotective#0127
@_discord_762008715162419261:t2bot.io
[m]
amazing thanks
NiChrosia#3367
@_discord_643940944181461023:t2bot.io
[m]
how would you go about filling a dynamically sized block of memory (like an array, but the size can't be set at runtime) with values?
is there a proc to set memory within a pointer?
code is more or less
let size: int
let memory = alloc(size * sizeof(T))

for index in 0 ..< size:
  # setMemory(memory, index * sizeof(T), value)
NiChrosia#3367
@_discord_643940944181461023:t2bot.io
[m]
the context is dynamically creating data to send via an OpenGL buffer (glBufferData(id: uint32, memory size of data: int32, pointer to data: pointer, usage: GLenum))
Elegantbeef
@elegantbeef:matrix.org
[m]
use a seq
NiChrosia#3367
@_discord_643940944181461023:t2bot.io
[m]
is a seq memory equivalent to an array?
If the data type is a value type it's contiguousu
NiChrosia#3367
@_discord_643940944181461023:t2bot.io
[m]
oh, nice
thanks
Elegantbeef
@elegantbeef:matrix.org
[m]
As the name implies they're sequential 😄