Re: c2nim (forked from Partial casing is foo_bar)

2016-07-20 Thread Araq
> Maybe that's a fair justification for partial-casing? I consider it to be largely orthogonal really. But coming back to `ALL_CAPS` macros. They are this way because C's preprocessor doesn't know anything about C's scoping rules or C's symbol table. ALL_CAPS are an archaic hack, and wrappers s

Re: c2nim (forked from Partial casing is foo_bar)

2016-07-20 Thread cdunn2001
I wrote: > Anyway, I do see your point. With `--nep1`, we're actually making disparate C > APIs look similar within Nim. Maybe that's a fair justification for > partial-casing? Rethinking, actually it seems the other way round. If we had case-sensitivity, then `c2nim --nep1` could be used to m

Re: c2nim (forked from Partial casing is foo_bar)

2016-07-20 Thread cdunn2001
Yes, I've used `#mangle` before. _Very_ helpful. `--nep1` is interesting. My complaint -- that the C library being wrapped could have conflicting identifiers -- is a minor one. I can always find ways around that. UPPER_CASE macros are the most common collision, and that's not a big deal since *

Re: Partial casing is foo_bar

2016-07-20 Thread Krux02
I know in scala (and possibly other programming languages), there is the option to rename imports. import some.package.{fooBar => foo_bar} According to the documentation here: [http://nim-lang.org/docs/manual.html#modules-import-statement](http://forum.nim-lang.org///nim-lang.

Re: Partial casing is foo_bar

2016-07-20 Thread OderWat
We can't afaik. The symbol table is about hash values and those are hard coded (see hashes.nim in the compiler) at one place and classic string compare cmpIgnoreStyle() in another one (see idents.nim). I did not understand all of it though.

Re: Partial casing is foo_bar

2016-07-20 Thread OderWat
Templates can not be used for simple aliasing of a procedure name like this `template echo = print`. You need to specify the parameters and that brings problems if you have a lot of overloaded functions or when they are from FFI. You can simply duplicate anything with a macro or create a macro w

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 LeuGim
Having `alias` functionality would be good regardless of the rest: for now templates are used for aliasing, and they are too general for such a simple thing.

Re: Partial casing is foo_bar

2016-07-20 Thread Stefan_Salewski
> would like to have a new "alias" functionality Was thinking about it a few times... For example, I have a longer proc with return type View. Can use predefined result variable in the proc, but then I have to remember that result is view. Or I use "var view: View ... return view". alias view r

Re: Partial casing is foo_bar

2016-07-20 Thread OderWat
>From looking at the code I think: * the compiler could be made identifier CS * probably pragmas CI (thats a bit harder because I think they are stored the same way as all identifiers) * ignoring underlines removed * allowing underlines in front and back. This would need few fixes to e

Re: Calling Nim compiled to dll from Java programs?

2016-07-20 Thread alexsad
Thanks all! @jangko, I tried your code. It works. But it exist one issue if I manipulate with 'cap' variable in proc Java_Sample1_stringMethod: for example cap.add("test") and in JAVA for(int i=0; i<1000; i++){ text = sample.stringMethod("JAVA"+i); } then I get: # A fatal error has been detec

Re: Partial casing is foo_bar

2016-07-20 Thread cjxgm
> -> IntelliSense / Code completion If it is really so "intelli", it should follow your casing (and guess your casing from the file you are editing). I don't use code completion so I may not be the right person to discuss this. > -> People following guides. Good luck on that. I can guarantee th

Re: Methods in Javascript backend

2016-07-20 Thread andrea
Great! I will not ask, but rest assured that I would not find this out on my own! :D

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 `camelCase`

Re: Partial casing is foo_bar

2016-07-20 Thread wulfklaue
> With partial casing, who give a f*** about the library author's casing style? > Just follow the style guide, no matter what. -> IntelliSense / Code completion: Will follow the original authors there casing. In other words you are then forced to use code completion & edit the code structure fo

Re: Partial casing is foo_bar

2016-07-20 Thread Araq
> Why the hell do the Nim OpenGL guy do the same thing with a much richer > language? Why are they implement enums as const s? Because I wasn't aware of the XML thingie at all and people improved my original wrapper. :) > How do you know that HTTP need to be in ALL_CAPS? This is offtopic, but

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, you

c2nim (forked from Partial casing is foo_bar)

2016-07-20 Thread Araq
> It would take similar effort (in sum) to fix the few problems in the Nim std > library as it takes me to fix the problems each time I run c2nim. Do you know about `--nep1` and `#mangle`? I used c2nim to wrap hundreds of thousands of lines of code. Yes, it's some work, but the results are reall

Re: Calling Nim compiled to dll from Java programs?

2016-07-20 Thread vega
@alexsad, you can do it using low level bindings (jnim.private.jni_wrapper) from jnim library for now, but it's no good. I'll make high level API for that ASAP.

Re: Partial casing is foo_bar

2016-07-20 Thread wulfklaue
> But striving for overall simplicity would mean to get rid of 99% of Nim > (macros, templates, converters, pragmas, ..., lots of stuff) and to create > quite an opposite language - then why to begin with Nim. Its not about removing features LeuGim... Its about making them more user friendly. N

Re: Calling Nim compiled to dll from Java programs?

2016-07-20 Thread jangko
You can get the source code [here](https://gist.github.com/jangko/48ba0b76716d0631560e5f2ff470256d). There are 5 files. how to build sample code: javac Sample1.java javah -classpath . Sample1 nim c --app:lib --passL:"-static-libgcc" --passL:"-Wl,--kill-at" Sample1

Re: Partial casing is foo_bar

2016-07-20 Thread LeuGim
_OderWat:_ There is nothing wrong with Basic or simplicity, just each language has some its characteristic feature, its accent. There cannot be C without pointer arithmetic, or Java without OOP, Basic without simplicity, Haskell without functional programming stuff, be each of those accents cons

Re: Partial casing is foo_bar

2016-07-20 Thread wulfklaue
> And changing it WILL break a lot of code... I don't even think that this > could be done without harm to Nim. \--- In all honesty, a default is better as fixed state, with the ability to override to stateless if people want to use it like that. The argument that it will break current code is