Re: What’s your favorite programming language and why?

2019-12-19 Thread drkameleon
But obviously you need a systems language for writing such lean, fast, reusable tools, and I think Nim or D are the best candidates. Yep, I also forgot about D. Before I discovered Nim, that was my #1 system programming language. Now - speed-wise - I'm definitely having a conversion...

Re: What’s your favorite programming language and why?

2019-12-19 Thread drkameleon
**Re: Nim**. I couldn't agree more. If there is ONE thing I absolutely _do not_ like about the language is the issue with the modules. Basically, to keep my head in some state of sanity, I try to keep everything in as few modules as possible, and "including" the rest of it (for "modularity") -

Re: What’s your favorite programming language and why?

2019-12-19 Thread kcvinu
I guess Nim's main problem is it's recursive module dependency. Its killing my module structure, I need to re-arrange all the stuff.

Re: What’s your favorite programming language and why?

2019-12-19 Thread kcvinu
@cantanima, Yes. I've tried Kotlin a few weeks ago, but without exe file, i can't do anything in windows. So i quit trying. Anyway, happy to hear that there is an option. Thanks.

Re: What’s your favorite programming language and why?

2019-12-19 Thread Libman
Shell scripting. (I use `mksh`, slowly thinking of transitioning to `zsh`.) I find myself being able to do a huge fraction of my tasks with just shell, common Unix tools, and some very useful new command line tools (ex `jq`, `curl`, etc). I make heavy use of running `$EDITOR` (ex `vim` or

Re: libgpiod wrapper uploaded to github

2019-12-19 Thread boia01
Curious what is the difference between libgpiod and wiringPi ? I've had no issues just calling directly into the wiringPi C API

Re: creating a enum type after calling a macro on various modules

2019-12-19 Thread mrgaturus
No, the final enum has the export marker and the group macro adds an entry for the final enum and creates an optional enum with suffix "Msg" for actions (with the export marker too): import macros # Groups Enum var groupEnum {.compileTime.} =

Re: creating a enum type after calling a macro on various modules

2019-12-19 Thread mratsim
Aren't you just missing the export marker in the generated intermediate enums?

Re: Nim beginners tutorial

2019-12-19 Thread adeohluwa
i agree... now give us an intermediate tutorial!

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-19 Thread Stefan_Salewski
More compact source code you may get with something like var a: array[32, byte] var p: ptr uint64 var myUint64: uint64 = 123456 p = cast[ptr uint64](addr a[8]) p[] = myUint64 Run but so you have no influence on endianess and of course you have to

Re: What’s your favorite programming language and why?

2019-12-19 Thread sschwarzer
I'd say my favorite programming language since about 20 years is Python and it's also the language I use most professionally. I like that it's quite expressive and has lots of libraries (not only external libraries, but I also like the standard library a lot). _Especially_ for small tools the

Re: What’s your favorite programming language and why?

2019-12-19 Thread gyohng
Like: * Python: Code looks clean, gets stuff done quickly, easy to hire people * JavaScript: Performant (thanks to browser wars), runs everywhere, Babel+Typescript/Flow make it bearable Dislike: * C++: bloated, messed up, pays too much attention to useless stuff and yet cannot easily

Re: Preview of Weave/Picasso v0.1.0, a message-passing based multithreading runtime.

2019-12-19 Thread rayman22201
@mratsim, Sorry. I should have been more specific. I didn't mean to compare Weave to those Rust libraries in terms of features. I was comparing them in terms of library size and level of abstraction (for lack of a better phrase.) What I meant to say is both Tokio and Rayon are "runtime"

Re: creating a enum type after calling a macro on various modules

2019-12-19 Thread mrgaturus
thanks, i do that, but the real problem is that i need import the enum before other groups are generated, i get an `undeclared identifier` error Module A from builder import groupType #Generate the enum type groupType(Groups) type GroupsSet* = set[Groups]

Re: Implementing a graph with newruntime, arc

2019-12-19 Thread b3liever
Thanks!

Re: What’s your favorite programming language and why?

2019-12-19 Thread drkameleon
Haha. I guess, it does. Perhaps, the more obscure the language, the better chances you have to find a project to work on (if you are an expert at it, I mean)

Re: What’s your favorite programming language and why?

2019-12-19 Thread cantanima
@kcvinu If you mean me (about Kotlin), download and use [Kotlin Native](https://kotlinlang.org/docs/reference/native-overview.html). I think I've done it once a while back.

Re: diff lib

2019-12-19 Thread marks
I think we're doing two different kinds of diff. My library takes sequences `a` and `b` and returns a sequence of "spans" (i.e., insert/delete/replace a from to, b from to) that if applied to `a` would transform it into `b`. This is explained in the Python [difflib

Re: Implementing a graph with newruntime, arc

2019-12-19 Thread Araq
Thanks, fix is here [https://github.com/nim-lang/Nim/pull/12935](https://github.com/nim-lang/Nim/pull/12935)\--gc:arc is what --newruntime evolved into, see https://github.com/nim-lang/RFCs/issues/177| ---|--- Your usage of `owned` is correct.

Re: Walking trees without recursive iterators

2019-12-19 Thread sschwarzer
@e Yes, it seems that's a bug that wasn't revealed by my existing unit tests. Thank you! I'll look what I can do. :-)

Re: How to use private variables when you put all types in one module

2019-12-19 Thread mashingan
> And i dont want to mix the implementation code with type declaration code. I > need to split as much code as possible. In different modules or in different files? If in different modules, as for now, everything exported are visible to other modules that import it. If it's only needed in

Re: "Selector must be of an ordinal type, float or string"

2019-12-19 Thread drkameleon
Whoa!! Super-weird. Didn't even think of that... Thanks! :)

Implementing a graph with newruntime, arc

2019-12-19 Thread b3liever
Hi, so the following code implements bfs search in a graph with adjacency lists. I have doubts if this is the correct way to use `owned` so please take a look: import deques type Edge = object neighbor: Node Node = ref object

Re: "Selector must be of an ordinal type, float or string"

2019-12-19 Thread SolitudeSF
but uint is... what?

Re: "Selector must be of an ordinal type, float or string"

2019-12-19 Thread SolitudeSF
uint64 is not an ordinal [https://nim-lang.github.io/Nim/manual.html#types-ordinal-types](https://nim-lang.github.io/Nim/manual.html#types-ordinal-types)

Re: What’s your favorite programming language and why?

2019-12-19 Thread Aiesha_Nazarothi
Probably, I'm only person in my city, who freelanced with Boo.

Re: How to use private variables when you put all types in one module

2019-12-19 Thread kcvinu
This is my use case. # module A type Control* = ref object or RootObj m_text* : string# ( This should be private) handle* : HWND # ( This can be public) ... # module B import A # here is the

Re: What’s your favorite programming language and why?

2019-12-19 Thread drkameleon
The next interesting question would be how many of us _do_ actually use our favorite language on a daily basis (meaning: professionally)

Re: creating a enum type after calling a macro on various modules

2019-12-19 Thread mratsim
See example in Synthesis: [https://github.com/mratsim/Synthesis/blob/3a443cf3/synthesis/factory.nim#L77](https://github.com/mratsim/Synthesis/blob/3a443cf3/synthesis/factory.nim#L77) I.e. Gather everything in a compile-time table or sequence and use a final macro `generateGroups` that read it.

Re: diff lib

2019-12-19 Thread mratsim
I have an advanced differ for arbitrary Nim types if you want to study how to transform yours into macro. My use-case is for a test suite so I throw an exception as soon as there is a mismatch.

Re: Preview of Weave/Picasso v0.1.0, a message-passing based multithreading runtime.

2019-12-19 Thread mratsim
A `runtime` means something that operates at `runtime` with extra overhead compared to anything done at compile-time by the compiler. It also means potentially interoperability issue. For example, a garbage collector or a reference counting scheme is also a runtime, extra overhead, not done at

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-19 Thread drkameleon
I perfectly understand what you're saying. I've benchmarked seq s myself _a lot_ and my conclusions are pretty much the same. The add s were left there for the sake of the example - my main concern was to get it working, and optimize the masking part first. But I obviously see your point -

"Selector must be of an ordinal type, float or string"

2019-12-19 Thread drkameleon
I'm trying to write a "switch-case" statement like: case MyVal of... Run where MyVal is of type "Value" (which is defined as a uint64). How do I make the compiler interpret it right (since an uint64 is obviously an ordinal type)?

Re: What’s your favorite programming language and why?

2019-12-19 Thread Aiesha_Nazarothi
1. _PureBasic_ for sheer coding transparency and awesome standard lib. 2. _CoffeeScript_ for code elegancy and interchangeability with ES. 3. _Boo_ for being still more well-thought than C# in awesome .NET ecosystem. 4. _Nim_ for optimization opportunities and custom DSLs.

Re: Translating C# code to Nim code. Help needed

2019-12-19 Thread dawkot
`# placeholder just to make the compiler shut up type Storage[T] = seq[T] proc newStorage[T](size: int): seq[T] = newSeq[T] size proc components[T](x: var seq[T]): var seq[T] = x type Entity = object id: int ComponentMotion = object x, y: float template setupComponent(t: typedesc) = var x

Re: How to use private variables when you put all types in one module

2019-12-19 Thread Stefan_Salewski
We had discussed that in the past, seem there is still no better solution: > [https://forum.nim-lang.org/t/4745#29623](https://forum.nim-lang.org/t/4745#29623)

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-19 Thread Stefan_Salewski
It should be obvious that for high performance you should avoid many add() operations for sequences. add() is a not trivial proc call, even when inlined it has to check if buffer is full and needs reallocation, and it has to increase len field. What was not that obvious for me is how much

Re: creating a enum type after calling a macro on various modules

2019-12-19 Thread dawkot
You'd have to gather group names in a compileTime variable.

Re: Can I Pass Multiple Identifiers to a Single Typed Macro Body?

2019-12-19 Thread 3nki
I ended up hacking a half-assed type system into the macro haha. If anyone has a better idea please let me know.

diff lib

2019-12-19 Thread marks
I've ported Python's difflib's sequence matcher to pure Nim: [diff](https://github.com/mark-summerfield/diff). It can be used to see the differences between any two sequences of items that support `==` and `hash()` (string, char, or any custom item type with the necessary support).

Re: Is it possible to browse the nimble.directory?

2019-12-19 Thread marks
Search is great if you know what you're looking for. But it is useless for getting an overview of what's available. And an overview of the third-party libraries is what I want when starting with a new language.

Can I Pass Multiple Identifiers to a Single Typed Macro Body?

2019-12-19 Thread 3nki
Something similar to this: [https://play.nim-lang.org/#ix=24QX](https://play.nim-lang.org/#ix=24QX) Alternatively, if there's a way to check if an Ident from an untyped AST is of type ntyObject, that could work too. I just need that check in _one_ place in my macro.

Re: Translating C# code to Nim code. Help needed

2019-12-19 Thread Pixeye
Thanks : ) LET'S CONTINUE import actors type ComponentMotion = object x, y: float #boilerplate var storageComponentMotion* = newStorage[ComponentMotion](100) proc componentMotion*(self: ent): ptr ComponentMotion = return addr

Re: How to use private variables when you put all types in one module

2019-12-19 Thread mashingan
If you need to access the field from other modules, then it's literally not private anymore. If you have specific function that have to work with that private field, then implement it in that common module and have that function exported. If you want to have read only for that specific field,

Re: USB Error on Epson Printer

2019-12-19 Thread nina007
Foutcode 0xf1 krijgen met mijn Epson-printer ... Ik ben geen technische zeeman, dus op zoek naar epson-ondersteuning !!! Bezoek ook deze links [https://www.klantenservicebelgies.com/epson-belgie](https://www.klantenservicebelgies.com/epson-belgie)/

Re: How to use private variables when you put all types in one module

2019-12-19 Thread kcvinu
Ok, So there is no option.

Re: Most efficient way to convert a uint64 to a seq of bytes

2019-12-19 Thread mrgaturus
Maybe casting the addr of the uint64 var to ptr array[4, bytes]?

Most efficient way to convert a uint64 to a seq of bytes

2019-12-19 Thread drkameleon
Right now this is how I'm doing it, but it definitely doesn't look very... efficient: (Value is just a uint64) proc writeValue(v:Value) = CD.add(Byte(v shr 56)) CD.add(Byte(v and Value(0x00ff))) CD.add(Byte(v and Value(0xff00)))

Re: macOs Catalina (10.15.2) - linking warnings

2019-12-19 Thread drkameleon
Hmmm I think I already figured it out. There were obviously object files remaining from a previous build (that is: _before_ the OS upgrade). What I did to "solve" it (make the warnings disappear actually) was to do a \--forceBuild:on release, and have the object files re-generated. Once I

macOs Catalina (10.15.2) - linking warnings

2019-12-19 Thread drkameleon
OK, so after a lot of hesitation, I decided to upgrade my system to 10.15 (I hope I won't regret it). Now after compiling my project as usual, I'm getting the following warnings: ld: warning: linking module flags 'SDK Version': IDs have conflicting values ('[2 x i32] [i32 10, i32