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*) type
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 what
template foo(txn, body: untyped): untyped =
let txn {.gensym.} = 1
body
foo hello:
echo hello
foo hello: # Error: redefinition of hello
echo hello
How do I make the name of entity passed as a template parameter a `gensym`
instea
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 tha
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,
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 baz[T
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.
> 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
Or, can we have the ability to modify symbol table in macros?
In this way, both `rename` and `alias` can be implemented in library.
And if
> 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 so
> 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
`camelCase`
* **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, you
> 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.}`.
[http://nim-lang.org/docs/manual.html#foreign-function-interface-varargs-pragma](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#for
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
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 j
15 matches
Mail list logo