Re: Nim improvement process

2016-08-11 Thread cjxgm
Well, I think we discussed this before, but "c" in `cstring` means "compatible" not the C language, and it's a magic type which may be different in different backend instead of unchecked ptr to array of char. cstring* {.magic: Cstring.} ## built-in cstring (*compatible string*)

Is it possible to import C #define constants without knowing their values?

2016-07-31 Thread cjxgm
Well, importing itself can be done easily like this: {.emit: """ #define HELLO_WORLD 10 """.} var x {.importc: "HELLO_WORLD", nodecl.}: cint echo x This will generate `LOC1 = nimIntToStr(((NI) (HELLO_WORLD)));`, which directly uses the name. Good. But

Re: Love nim but at the same time starting to hate it...

2016-07-26 Thread cjxgm
After the 1.0 release, the language and standard libraries SHOULD be pretty stable. So external documentation should not be a problem in this regard. [cpp reference](http://forum.nim-lang.org///en.cppreference.com/w/) is THE best language and stdlib reference I've ever seen, much much better

Re: Questions about UFCS and generics

2016-07-26 Thread cjxgm
Understood the `#2` case. > With #7 you pass a type as just an argument (something, that is passed at > run-time), it can be used only within the body of the procedure, not for > declaring its result. But why this compiles: proc quz(x: float, T: typedesc): T = 1 echo quz(1.0,

Questions about UFCS and generics

2016-07-25 Thread cjxgm
proc foo[T](x: float): T = T(x) echo foo[int](1.0) #1 compiles echo 1.0.foo[int]() #2 Error: cannot instantiate: 'T' proc bar[T](x: float, _: typedesc[T]): T = T(x) echo bar(1.0, int) #3 compiles echo 1.0.bar(int) #4 compiles proc

Re: agar wrapper

2016-07-23 Thread cjxgm
FLTK does have [some sort of automatic layout](http://forum.nim-lang.org///fltk.org/articles.php?L415+I20+T+P1+Qresize) feature, although it's based on pixel positions/sizes.

Re: nim plus webdriver?

2016-07-23 Thread cjxgm
> a RESTful / JSON Protocol Then [httpclient](http://forum.nim-lang.org///nim-lang.org/docs/httpclient.html) \+ [json](http://forum.nim-lang.org///nim-lang.org/docs/json.html) will do. And the protocol is here: [Webdriver Spec](https://w3c.github.io/webdriver/webdriver-spec.html) (Just scroll

Re: Partial casing is foo_bar

2016-07-20 Thread cjxgm
Or, can we have the ability to modify symbol table in macros? In this way, both `rename` and `alias` can be implemented in library.

Re: Partial casing is foo_bar

2016-07-20 Thread cjxgm
gt; people are bothered with the "free" casing style, it can now be reported that > you can have free or fixed styling. More options, more fun cjxgm: Want to put > it forward to the Nim committee for a vote? It's just an initial thought. But it still can't solve the problem:

Re: Partial casing is foo_bar

2016-07-20 Thread cjxgm
> This is offtopic, but it really shouldn't. If the casing where all that > important, how come every URL I look at starts with 'http(s)'? Well I didn't mean to start a discussion on that, but just give an example showing that `snake_case_Caps_allowed` contains more information than

Re: Partial casing is foo_bar

2016-07-20 Thread cjxgm
* **I find partial casing can better enforce the casing style** Your organization must have a style guide and it must say something about naming convention and casing style (What? You don't have such thing? How crazy are you people!). And all of you are following that casing style. Then,

Re: Nim in Action is now available!

2016-07-18 Thread cjxgm
> Should we also have "Ben".cstring? You don't need to do it, because "Nim string values will be converted to C strings automatically" for `{.varargs.}`.

Re: Nim in Action is now available!

2016-07-18 Thread cjxgm
About the `{.importc.}`, `{.importcpp.}`, `cstring` thing, they should really be called `{.importnp.}`, `{.importnoo.}`, `nstring`, etc, where `n` means "native", `np` means "native procedural style", `noo` means "native object-oriented style". Or even better, `{.import.}`, `{.importoo.}`, and

Re: Things that are great when working in the Nim Language

2016-07-18 Thread cjxgm
What I liked so far: * * * * **Express the intention of "base" instead of "override".** We have `override` keyword in C++ and `@Override` annotation in Java, to express our intention of "overriding the base function instead of creating a new base function/overloading/overwriting". That's