Re: How do I make a table of tables in Nim?

2019-10-13 Thread Tiberium
I really think you should use objects for this, but this will work anyway: import tables var books = newTable[string, TableRef[string, string]]() books["one"] = newTable[string, string]() books["one"]["price"] = "150" echo books["one"]["price"]

Re: Xors3D game engine for Nim [wrapper]

2019-09-26 Thread Tiberium
What about Godot? It also has Nim bindings and Godot generally has a pretty good 3D support already.

Simple snippet for colored logging with named arguments

2019-02-02 Thread Tiberium
I just wanted to have logging which has colors, and also have chronicles-style printing of arguments, so I created this relatively small snippet for logging: [https://gist.github.com/Yardanico/0bcf50c05b71ae8990529ea0913ac068](https://gist.github.com/Yardanico/0bcf50c05b71ae8990529ea0913ac068)

Simple snippet for easy colored logging with levels

2019-02-02 Thread Tiberium
I just wanted to have logging which has colors, and also have chronicles-style printing of arguments, so I created this relatively small snippet for logging: [https://gist.github.com/Yardanico/5e2c012b184d45c4a845f820927cc2e1](https://gist.github.com/Yardanico/5e2c012b184d45c4a845f820927cc2e1)

Re: Is there a handy way to declare Rune literals?

2018-10-19 Thread Tiberium
Since Unicode contains all ASCII characters you can easily do that: import unicode let my_rune = Rune(ord('.')) echo my_rune Run

Re: Nim versus Julia benchmark comparison

2017-12-18 Thread Tiberium
@mratsim Why does Nim need warm-up? I've never heard about that.

Re: cannot import windows

2017-11-13 Thread Tiberium
You should do "import oldwinapi/windows", not "import windows".

Re: question on range types

2017-11-01 Thread Tiberium
They are checked at runtime, but not in release mode (because -d:release does --rangeChecks:off)

Re: How do you get thread count in Nim

2017-10-30 Thread Tiberium
TS probably means "processor threads" \- Hyper Threading

Re: Nim Manual: wrong link: "lock levels"

2017-10-23 Thread Tiberium
Please report it on github!

Re: request for feedback - type safe OpenGL wrapper

2017-10-23 Thread Tiberium
jackmott: I really think you should use templates instead of inlined procs here, because it's not guaranteed that proc will be inlined (even with inline pragma)

Nim discord server

2017-10-23 Thread Tiberium
I've created a new Discord Nim channel: [https://discord.gg/ezDFDw2](https://discord.gg/ezDFDw2)

Re: What should next Araq's live stream be about?

2017-10-20 Thread Tiberium
The recording is now available! [https://www.youtube.com/watch?v=KNUDGZuqfQM](https://www.youtube.com/watch?v=KNUDGZuqfQM)

What should my next Araq's stream be about?

2017-10-18 Thread Tiberium
[http://www.strawpoll.me/14163114](http://www.strawpoll.me/14163114) Vote for your favourite topic! Araq will be streaming on Thursday, 19:00 UTC!

Re: "Person = object" still has a type field by default?

2017-10-13 Thread Tiberium
Yes, not using object of meant you were "pure"

Re: noob confusion stream of conciousness

2017-10-11 Thread Tiberium
About toString - in Nim $ is used as a stringify operator for almost all types anywhere (not only in stdlib). So firstly try $ on a type

Re: Ideas for calling CGAL from Nim?

2017-10-08 Thread Tiberium
c2nim already supports C++ templates

Re: Python-like with, context managers, and the RAII pattern

2017-10-07 Thread Tiberium
cdunn2001: "There's actually a lot of places I'd really like to use "withAs" in, eg to make sure that resources are closed, but without needing to add a resource-specific "defer" line." So wizzardx will need to create a template like this for every type he'll use

Re: "Cross-platform C" target for Nim?

2017-10-07 Thread Tiberium
wizzardx: yes, and nim uses niminst

Re: Simple logging with module filename and line number

2017-10-05 Thread Tiberium
coffeepot: I'm afraid it isn't possible to implement it using a variable (e.g. something like $line). Yeah, it is possible to add this just as template, but I don't really think it would be accepted in stdlib

Simple logging with module filename and line number

2017-10-04 Thread Tiberium
Nim allows getting a line number from a template (via compile-time information). So you can make a log template to do that: import logging, strutils var logger = newConsoleLogger(fmtStr = "[$time][$levelid]") addHandler(logger) template log*(lvl: Level, data:

Re: How to

2017-10-01 Thread Tiberium
monster: you wouldn't get only "syntax highlighting" with VSCode. Nim plugin also supports "nim check" \- checking files for errors, and nimsuggest - code completion (it knows everything about Nim)

Re: directory structure for a multi-file project?

2017-10-01 Thread Tiberium
[https://gist.github.com/stisa/09474a952a420448778685507d3fbd51](https://gist.github.com/stisa/09474a952a420448778685507d3fbd51)

Re: Python-like with, context managers, and the RAII pattern

2017-09-30 Thread Tiberium
well, no, only "with" and "without": [https://github.com/nim-lang/Nim/commit/3ccc9c467d84dc8c3412acbea20fc10b5335eaa8](https://github.com/nim-lang/Nim/commit/3ccc9c467d84dc8c3412acbea20fc10b5335eaa8)

Re: Python-like with, context managers, and the RAII pattern

2017-09-30 Thread Tiberium
Udiknedormin: you can change "take" to "with", since "with" and "without" were removed from Nim keyword list in devel

Re: Python-like with, context managers, and the RAII pattern

2017-09-30 Thread Tiberium
It's very easy with "quote do": import macros proc my_enter(x: int): int = echo "my_enter was called" return x proc my_exit(x: int) = echo "my_exit was called" macro take(args, body: untyped): untyped = # Value of an argument

Re: Python-like with, context managers, and the RAII pattern

2017-09-28 Thread Tiberium
You can use defer for closing resources: [https://nim-lang.org/docs/manual.html#exception-handling-defer-statement](https://nim-lang.org/docs/manual.html#exception-handling-defer-statement)

Re: Are array types that differ only in index boundaries different?

2017-09-26 Thread Tiberium
LeuGim: a side note: it's not an implicit conversion, with "var x: int8" Nim treats your "3" literal as "int8" type

Re: Error: cannot instantiate: 'OrderedTable'

2017-09-25 Thread Tiberium
sflennik: your code is wrong, OrderedTable can't contain different types It should be like this: from tables import OrderedTable, toOrderedTable proc getMetaInfo(filename: string, fileSize: int64): OrderedTable[string, string] = result = { "filename":

mathexpr, a math expression evaluator library in Nim

2017-09-24 Thread Tiberium
[https://github.com/Yardanico/nim-mathexpr](https://github.com/Yardanico/nim-mathexpr) This is a mathematic expression evaluator library in pure Nim (with no third-party dependencies). Basically it is a recursive descent evaluator. It supports many mathematical functions, also you can provide

Re: Using Plotly.js in Nim

2017-09-22 Thread Tiberium
Well you would wrap this functions too? And I really think you should make it a real wrapper

Re: Nimscript: setLen segfaults?

2017-09-22 Thread Tiberium
Udiknedormin: can you post a code example? And also create an issue on github

Re: Too many global variables in a generated js-code

2017-09-15 Thread Tiberium
@alexsad - don't try to compare JS code compiled by Nim with hand-written JS. It's almost the same if you compare hand-written C++ with C++ code compiled by Nim

Re: Containers of generic types

2017-09-14 Thread Tiberium
cdome: but one problem - vtrefs are not implemented yet

Re: Random idea - porting python 3 stdlib to Nim.

2017-09-06 Thread Tiberium
[https://github.com/Yardanico/nimpylib](https://github.com/Yardanico/nimpylib)

Re: Differences: Object variant vs static conditional fields

2017-09-06 Thread Tiberium
Yes, Stefan_Salewski is right: type NodeKind = enum # the different node types nkInt, # a leaf with an integer value nkFloat# a leaf with a float value # Version 1 with object variant Node = ref NodeObj NodeObj

Re: Killing an AsyncHttpServer

2017-09-05 Thread Tiberium
Try to add gcsafe pragma to your proc

Re: Compositional inheritance voodo

2017-09-04 Thread Tiberium
You can also try concepts

Re: Nim newbie request/challenge

2017-09-02 Thread Tiberium
But you shouldn't write export PATH... in terminal you should write it in your .bashrc or .zshrc or .rc

Re: Convert tuple into a Object

2017-09-01 Thread Tiberium
My macro: import macros macro createObj(typ: typedesc, data: untyped): untyped = # This macro only accepts tuples in parenthesis, but this can be changed assert data.kind == nnkPar # Object construction syntax result = newTree(nnkObjConstr) #

Re: Convert tuple into a Object

2017-09-01 Thread Tiberium
You can definitely do this with a macro

Re: Nim newbie request/challenge

2017-09-01 Thread Tiberium
Maybe you can't access Nim directory from user account because it has wrong permissions? And also maybe you have another Nim installed?

Re: Simple Python-like class macro and some python-like procedures (print, input, range, others)

2017-08-27 Thread Tiberium
Udiknedormin: yeah, or maybe IRC

Re: Simple Python-like class macro and some python-like procedures (print, input, range, others)

2017-08-27 Thread Tiberium
Udiknedormin, I've added lazy evaluation for range - [https://github.com/Yardanico/nimpylib/blob/master/src/pylib/range.nim](https://github.com/Yardanico/nimpylib/blob/master/src/pylib/range.nim)

Re: Reason for -fno-strict-aliasing?

2017-08-25 Thread Tiberium
I've even changed -fno-strict-aliasing to "-fstrict-aliasing -Wstrict-aliasing" in build.sh (in csources), and nim compiler compiled without any issues!

Re: Estimation of π using Leibniz series

2017-08-14 Thread Tiberium
It seems that Julia JIT is aware of SSE extensions and it uses them. GCC or MSVC should be emitting them too, but it depends on C code

Gource visualization of the Nim repo history

2017-08-12 Thread Tiberium
If you don't want the music, just turn it off History from 2008 to 2017 [https://www.youtube.com/watch?v=rUJ7Bzgv3n0](https://www.youtube.com/watch?v=rUJ7Bzgv3n0)

Re: thounghs about Nim language in godot

2017-08-02 Thread Tiberium
DTxplorer: don't worry, nothing bad

Re: thounghs about Nim language in godot

2017-08-01 Thread Tiberium
DTxplorer, you need to install godot-nim package itself first

Re: thounghs about Nim language in godot

2017-07-31 Thread Tiberium
You can now use Godot-Nim with master branch of Godot (so newest version)

Re: thounghs about Nim language in godot

2017-07-28 Thread Tiberium
Author said that only one PR to godot engine left

Re: thounghs about Nim language in godot

2017-07-28 Thread Tiberium
>From the example: # Copyright 2017 Xored Software, Inc. import strutils import godot import engine, label, resource_loader, packed_scene gdobj FPSCounter of Label: var lastFPS: float32 method ready*() = setProcess(true)

Re: thounghs about Nim language in godot

2017-07-28 Thread Tiberium
[https://github.com/pragmagic/godot-nim](https://github.com/pragmagic/godot-nim) Yay, proper GDNative bindings!!!

Re: echo proper string in different consoles?

2017-06-21 Thread Tiberium
There's a simpler way to change the codepage import os discard execShellCmd("chcp 936")

Nim support on repl.it

2017-04-15 Thread Tiberium
Hi everyone! repl.it started a vote poll called "Language requests". Since repl.it already supports C and C++, I think it would be not hard for them to add Nim support. Vote [here!](https://replit.canny.io/languages-requests/p/nim)