Have you ever wondered why Google (a for-profit mega-corp that makes money by
manipulating people, and was pretty much a member of the government during the
prior US administration) is giving things away for "free"?
Meta-programming has trade-offs, which is why languages like Go chose to avoid
it. The main ones are:
* **Added Compile Time.** Nim is already implicitly taking a stand that you
shouldn't do your compiling on a low-end machine, and I believe that we are on
the right side of history. (This
I noticed that this blog article was [just resubmitted to Hacker
News](https://news.ycombinator.com/item?id=18825102) by someone named mindB.
It's currently in 8th place / 24 points / no comments so far.
Nice work @geotre. Please share your experience with using nimgen when you get
a chance.
Python has had considerable growth over the past few years, and it was just
named the **TIOBE Programming Language Of The Year** again for 2018. I wonder
if that makes my above point of "Appeal to Python Fans" worthy of a second look.
My points about appealing to freedom zealots ("license
I generate two AST's using two different templates. Replacing one node of the
fist tree with the whole second tree woks fine. How can I define a variable in
the first template and use it in the second?
template first(): untiped =
var n = 1
echo "this very line gets
> 10\. Are you willing to help making Nim documentation better? :)
This is half the crux of the matter.
Documentation developed by a committee won't work. It needs **leadership** ,
but with all of us contributing. (Existing standard Nim doco already has
leadership by @Dom and @Araq)
Hey @lqdev I've switched the wren package to use nimgen and compile in the
code, so there's no longer any requirement for libwren.so or the dynlib pragmas.
It's also going on nimble -
[https://github.com/nim-lang/packages/pull/977](https://github.com/nim-lang/packages/pull/977)
Let me know if
Yes, I'm using parseEnum
proc findBrokerEnum(txt: string): MyBrokerTypes =
try:
result = parseEnum[MyBrokerTypes](txt)
except:
printf("MyBrokerType not found %s\n",txt)
quit(QuitFailure)
Run
Looks like you want to convert a string into an enum, look
here:[https://stackoverflow.com/questions/42977509/nim-standard-way-to-convert-integer-string-to-enum](https://stackoverflow.com/questions/42977509/nim-standard-way-to-convert-integer-string-to-enum)
there is a parseEnum proc in strutils
Thanks for your reply. In my example, all the enum items also have an
underlying int value as well as the text field. I am parsing csv files
containing the text parts of the enums, so I need those text parts. To 'see',
the $ operator shows the text field and the .ord operator shows the int
Hi, just learning Nim as well, so I might be wrong but this is maybe what you
want:
type
MyBrokerTypes {.pure.} = enum
valSvcFee ,
valWirFnd ,
valSell ,
valBuy ,
valCasDiv
var BrokerBankLike : set[MyBrokerTypes]
I’m fiddling around with enum and set. The attempt is to get a type checked
expression of what I mean… The enum items come from fields in a CSV file.
I have an enum defined as below. I will have more questions, but my first
question is how to write a set using my enum types as the basetype of
Awsome !!!
@Ward, thanks to your absolutely amazing libraries (wNim and winim) I was able
to create my wAppbar component (pretty important part of UI for my current
project). It was interesting trip - deep in Windows GUI, in Nim and in wNim.
Actually it was much more difficult to deal with that specific
Ok, I guess. Alternatively use fewer directories. :P
In devel we have "tut 3" about Nim's macros. There should be dedicated
tutorials about the GC, memory management and async and the modules should link
to the tutorials. I'm not sure that long walls of text in
By the way, I like the following approach as it methodically covers the reasons
why someone would look into documentation:
[https://www.divio.com/blog/documentation](https://www.divio.com/blog/documentation)
The main takeaway is that people looking into documentation have different
needs and
Can you add your myArray type and fillArray() proc declaration?
Also make sure to triple-quote your code samples.
proc main() =
echo "Calling fillArray procedure..." let a : myArray = fillArray()
when isMainModule:
main()
According to the Nim documentation (I don't remember if it was on Nim by
Example, or in the Nim manual), but var a: myArray instanciates by itself the
nested array. This code
I generally find Nim's documentation ok, so it is not my top priority. That
said, the areas that are not well-documented are:
* the various modes of GC: which one are available? how do they differ? which
external requirements do they have - bohem, go libs etc. Especially, it is not
clear how
I dont have QQ and dont understand chinese. Can you get in touch on QQ with the
author of XCGUI and ask about an english docu and nim bindings ? Should be
fairly trivial to copy Go's or with nimgen.
These practices helped me, don't know whether they are "best" :-)
**Keep it obvious** : inner templates are probably more readable than
constructing and assembling AST nodes "by hand":
macro m(...): untyped =
template tpl(...) =
# people see what is built here
23 matches
Mail list logo