This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compile and run with 'nim c -r -d:useRealtimeGC -d:release main.nim' | |
import strutils | |
#import times | |
include "lib/system/timers" | |
const | |
windowSize = 200000 | |
msgCount = 1000000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
raiseEx = True | |
returnA = True | |
returnB = True | |
try: #A | |
try: #B | |
if raiseEx: | |
raise OSError() | |
return 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template task*(name: untyped; description: string; body: untyped): untyped = | |
## Defines a task. Hidden tasks are supported via an empty description. | |
## Example: | |
## | |
## .. code-block:: nim | |
## task build, "default build is via the C backend": | |
## setCommand "c" | |
proc `name Task`*() = | |
setCommand "nop" | |
body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nimble install -y --verbose https://github.com/Araq/ormin | |
Reading config file at C:\Users\rumpf\AppData\Roaming\nimble\nimble.ini | |
Downloading https://github.com/Araq/ormin using git | |
Error: Could not read package info file in C:\Users\rumpf\AppData\Local\Temp\nimble_12672\githubcom_Araqormin\ormin.nimble; | |
... Reading as ini file failed with: | |
... Invalid section: . | |
... Evaluating as NimScript file failed with: | |
... Invalid field: C. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Stuff = object | |
proc bah {.tags: [Stuff].} = | |
discard | |
proc main = | |
bah() | |
echo "hi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, std / varints | |
proc main = | |
let self = os.getAppFilename() | |
let content = readFile(self) | |
let origSize = int(uint32(content[^4]) shl 24u32 or uint32(content[^3]) shl 16u32 or | |
uint32(content[^2]) shl 8u32 or uint32(content[^1])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
when defined(nimOpMove): | |
proc `=move`[T](x, y: var seq[T]) = | |
mixin `=destroy` | |
if a.p != b.p: | |
var a = cast[ptr NimSeqV2[T]](addr x) | |
var b = cast[ptr NimSeqV2[T]](addr y) | |
if a.p != nil: `=destroy`(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import core / allocators | |
import system / ansi_c | |
type | |
Widget* = ref object of RootObj | |
drawImpl: owned(proc (self: Widget)) | |
Button* = ref object of Widget |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
var j = newJObject() | |
var i = newJString("23") | |
j["foo"] = i | |
j["bar"] = i | |
echo j["foo"] | |
j["bar"].str = "34" | |
echo j["foo"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# | |
# Nim's Runtime Library | |
# (c) Copyright 2012 Andreas Rumpf | |
# | |
# See the file "copying.txt", included in this | |
# distribution, for details about the copyright. | |
# | |
# string & sequence handling procedures needed by the code generator |