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
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
Yea you are correct they would normally be named differently.
In this case however it's more like versioned inheritance
Dog
Dog # (V2)
Rika#2434
@_discord_259277943275126785:t2bot.io
[m]
hmm i see
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
type 
  Dog = object
    age: int

  # Another file (V2)
  Dog = object of first_file.Dog
   weight: int
Rika#2434
@_discord_259277943275126785:t2bot.io
[m]
embed the version in the type, then alias the versioned type into a "regularly named" type?
v1 in a v1 module, etc
then in some "all types" module type Thing = ThingV7 or so
export it too sorry
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
Hmm, so then you're doing all_types.Thing | all_types.Thing2
Rika#2434
@_discord_259277943275126785:t2bot.io
[m]
?
i dont really know what your versioning use case is
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
The versioned use case is the beacon chain, and supporting older versions of validator systems
Sorry to be less specific, a crypto use case in a format like git branching
Rika#2434
@_discord_259277943275126785:t2bot.io
[m]
i get it im still thinking about a solution
b1rdf00d#1826
@_discord_775600941985431562:t2bot.io
[m]
how will you know which TypeA you want to return?
1 reply
b1rdf00d#1826
@_discord_775600941985431562:t2bot.io
[m]

If you're happy to do this: something[test_a]() -> test_a.TypeA , then what about

something[test_a.TypeA]() -> test_a.TypeA ?

1 reply
It's interesting what you're trying to do, but I don't think I grasp what makes one of the types in the module special to become the return type. It sounds like it's purely based off the type name?
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
I think I'm getting closer though
import macros
import "."/[test_a, test_b]

macro something(kind: untyped) =
  quote do:
    `kind`.Type(data: 5)

echo something(test_a)
echo something(test_b)
Error: expression 'test_a.Type(data: 5)' is of type 'Type' and has to be used (or discarded)
Is there some easily spottable problem with the above code?
b1rdf00d#1826
@_discord_775600941985431562:t2bot.io
[m]
should that macro have a return type?
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
Hmm
b1rdf00d#1826
@_discord_775600941985431562:t2bot.io
[m]
I'm only just trying to write my own macros 🥲
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
That's it!
b1rdf00d#1826
@_discord_775600941985431562:t2bot.io
[m]
But it looks like that's a function with no return
Nalmyth#1977
@_discord_551981957521735690:t2bot.io
[m]
import macros
import "."/[test_a, test_b]

macro something(kind: untyped): untyped =
  quote do:
    `kind`.Type(data: 5)

echo something(test_a)
echo something(test_b)
Result
(data: 5)
(data: 5)
Thank you guys, very helpful 🙏
b1rdf00d#1826
@_discord_775600941985431562:t2bot.io
[m]
🦆 , no worries 🙂 was an interesting question
qb#2308
@_discord_590220785029873674:t2bot.io
[m]
Is there something in the standard libs to get the screen resolution?
auxym#2224
@_discord_882793909246369864:t2bot.io
[m]
hm that might be something you would have to get from wayland/x on linux, and from win32 api on windows
(just guessing)
qb#2308
@_discord_590220785029873674:t2bot.io
[m]
Yea I know. Was just hoping theres something done
PMunch[IRC]#0000
@_discord_709044657232936960_=50=4dunch=5b=49=52=43=5d:t2bot.io
[m]
Don't think so, unfortunately
I implemented something like this for notifishower, you're free to grab the code for x11 from there if you want to make a library out of it :)
I mean you can't do screen resolution without handling multi-monitor setups
notifishower does that, it creates and updates a list of monitors
flywind#1563
@_discord_658563905425244160:t2bot.io
[m]
Is there a better solution for andreaferretti/cello#4 ?
jos#7388
@_discord_610710352254205952:t2bot.io
[m]
when i run nimble test, i get this odd error
Compiling C:\Users\jos\dev\tfp\labs\crag\tests\test_scanner (from package crag) using c backend fatal.nim(53) sysFatal Error: unhandled exception: index 3 not in 0 .. 2 [IndexDefect] Tip: 3 messages have been suppressed, use --verbose to show them. Error: Execution failed with exit code 1 ... Command: C:\Users\jos\.nimble\bin\nim.exe c --noNimblePath -d:NimblePkgVersion=0.1.0 --path:C:\Users\jos\.nimble\pkgs\patty-0.3.4 --hints:off -r --path:. C:\Users\jos\dev\tfp\labs\crag\tests\test_scanner
it doesn't matter what's inside my test file
i always get this error
i have no clue how to debug this, is there a way to get a full stack trace?
1 reply
jos#7388
@_discord_610710352254205952:t2bot.io
[m]
ok well I think it's missing the .nim in the cli command listed at the bottom, which might make sense?
idk why it would, or if it's supposed to
Rika#2434
@_discord_259277943275126785:t2bot.io
[m]
thats fine
at least it should be
Yardanico#5346
@_discord_177365113899057152:t2bot.io
[m]
how did you install nim?
if you want to get the compiler stack trace, you need to build the compiler in debug mode
jos#7388
@_discord_610710352254205952:t2bot.io
[m]
I used choosenim