Strange error message from collections/sets.nim

2020-11-24 Thread ElegantBeef
Why is it always people say "Tabs for indenting and spaces for alignment", since when was alignment a requirement of code. "Tabs for indenting and spaces for spaces" is where it's at. I do not see any benefit of aligning code using spaces, if you want to have aligned code you can always do the b

closure in hashset, fail to compile with c++ backend

2020-11-24 Thread tommo
thanks, will do!

Macro for proc like syntax?

2020-11-24 Thread zetashift
That is very true! I was posting as someone who doesn't use Nim that much sadly, but does use Godot a bit more.

Macro for proc like syntax?

2020-11-24 Thread Araq
> And even though it might be more idiomatic Nim, I feel like the signal > mySignal is cleaner then the pragma and conveys the intent better for the > Godot signal use case. This doesn't make much sense, sorry. "is cleaner" for _somebody_ , and for _Nim programmers_ it seems unlikely to be "cle

Macro for proc like syntax?

2020-11-24 Thread zetashift
A lot of good suggestions in this thread but there might be some context missing: And even though it might be more idiomatic Nim, I feel like the `signal mySignal` is cleaner then the pragma and conveys the intent better for the Godot signal us

Macro for proc like syntax?

2020-11-24 Thread elcritch
The {.signal.} is readable to me. Though if you need to pass some data variable to the macro for further usage you could copy [nim-json-rpc's](https://github.com/status-im/nim-json-rpc) approach: var router: Router = ... router.rpc("updateData") do(myObj: MyObject, newData:

Macro for proc like syntax?

2020-11-24 Thread Araq
Indeed the most idiomatic solution is: proc my_signal(a:bool = true) {.signal.} Run

Macro for proc like syntax?

2020-11-24 Thread geekrelief
Thanks, I've considered that option as well. And like xigoi suggested below having optional and non-optional arguments together could pose a problem. Had a vote and it seems everyone prefers default argument values specified in the body.

Strange error message from collections/sets.nim

2020-11-24 Thread slonik_az
> @Stefan_Salewski: Python does or at least did allow Tabs for indentation, so > it is possible. Python 2 allowed Tabs and Spaces and their mixing. Python 3 allows Tabs and Spaces but does not allow mixing them in indentation.

compile-time import

2020-11-24 Thread zevv
`--os:any --gc:arc and -d:useMalloc` is the tested and proven trio that should work on any reasonable ANSI C implementation. If you even lack a decent stdlib you can stub some of the basic functions like `malloc()`, `fopen()` and still get to run on bare silicon.

compile-time import

2020-11-24 Thread Araq
> Should it work without any syntax changes? Yes, it should simply work. > Now I think all of them will be included in build even if they are not used > in main code Nah, it's stripped away.

C++ FFI - basic example

2020-11-24 Thread mantielero
@AlectronikHQ, have you considered [skia wrapper](https://github.com/mvenditto/nimskia)? I don't know how mature it is.

compile-time import

2020-11-24 Thread Araq
Another solution: Use `staticExec` to run helper programs at compile-time to determine things like MCU-specific registers.

compile-time import

2020-11-24 Thread alexiss
> PRs are welcome. ;) Could you give me some direction? Should it work without any syntax changes or we need to point such imports with somethink like `static import os` or `import os {.compileTime.}`? Some hints of where to look best whould be very useful

compile-time import

2020-11-24 Thread alexiss
> Another solution: Use staticExec to run helper programs at compile-time to > determine things like MCU-specific registers. I'm afraid this is not a solution in my case - I have a lot of checks in several places while compilation. For example - is register read-only or not, can we set this MCU

compile-time import

2020-11-24 Thread Araq
> Is it possible somehow? Damn, I thought `--os:any` would simply work... PRs are welcome.

compile-time import

2020-11-24 Thread alexiss
@Araq thank you for fast reply! After changing `--os:standalone` to `--os:any` I have following error: Error: Port memory manager to your platform Run Not very informative for me. Here is my `nim.cfg` define: "EmbedTarget=stm32f334r8t6" arm.any.g

C++ FFI - basic example

2020-11-24 Thread Araq
Compile via `` nim cpp blend2d.nim``

Custom source code filters?

2020-11-24 Thread Araq
No. Adding one to the Nim compiler isn't pretty straight-forward but we don't accept such pull requests. Source code filters predate Nim's macro system iirc, you're supposed to use Nim macro system instead. Having said that, source code filters are suprisingly popular. :-)

compile-time import

2020-11-24 Thread Araq
That's why we have `--os:any` that replaces `--os:standalone`.

Strange error message from collections/sets.nim

2020-11-24 Thread Stefan_Salewski
> Popularity and wide spread of Golang We should really not compare to Golang. Golang has not significant white space, and Golang's main reason for its popularity is that it is a child of Google. The initial fear in Nim about tabs was that mixing tabs and spaces for indentation would be very b

Strange error message from collections/sets.nim

2020-11-24 Thread slonik_az
> @Araq: Oh not that again... That never worked for any codebase I've ever seen. Popularity and wide spread of Golang is a testament that "TABs for indentation, Spaces for alignment" does work in practice. In fact, editors like VScode and Goland achieve it so transparently that many Golang coder

Custom source code filters?

2020-11-24 Thread xigoi
Is there any way to create a custom source code filter function?

compile-time import

2020-11-24 Thread alexiss
Hi, guys! I'm writing a library that helps in embedded programming. The idea is to make a bunch of macros that expands into MCU-specific registers access. For example for STM32: mcu.RCC.AHBENR["IOPAEN"] = 1 Run I have a working sekelton now but I get a problem when t

C++ FFI - basic example

2020-11-24 Thread AlectronikHQ
Tried to write a binding to blend2d () but stumbled upon this error: {.link: "/usr/lib/libblend2d.so" passC: "-I/usr/include" } {.push header: "/usr/local/include/blend2d.h"} {.push header: "/usr/local/include/blend2d-impl.h"} type

asynchttpserver, keep-alive and concurrent queries

2020-11-24 Thread benob
I am writing a basic web framework which can send files in chunks instead of copying them in full to memory. When testing pages with many images, a lot of them end up corrupted even though individually downloading them with curl gives the correct data. I am suspecting that there is an interacti

Macro for proc like syntax?

2020-11-24 Thread xigoi
The problem is when you want to have both optional and non-optional arguments.

closure in hashset, fail to compile with c++ backend

2020-11-24 Thread Araq
Please report bugs on github.

Strange error message from collections/sets.nim

2020-11-24 Thread cblake
Some more details here to support @Araq's point and [links](https://forum.nim-lang.org/t/2105) to [prior discussion](https://forum.nim-lang.org/t/5943). This really does seem like an editor question, though. The only reason this style might be attractive in the first place is because most edito

Changer VSCode pour VSCodium

2020-11-24 Thread gemath
> According to the VS Code Marketplace Terms of Use, you may only install and > use Marketplace Offerings with Visual Studio Products and Services. Thanks for pointing that out. In a worst case scenario, MS could use this as a legal weapon against people who just built VSCode themselves from the

Strange error message from collections/sets.nim

2020-11-24 Thread Araq
> We have really discussed that topic enough in the last 5 years. Yeah, I'm waiting for 5 years for an answer why your editor cannot turn tabs into spaces.

Macro for proc like syntax?

2020-11-24 Thread gemath
This should work if you leave out the parameter type, it is redundant anyway whith the default value specified: signal my_signal(a = true) Run This is parsed as command syntax and can be transformed to a forward `proc` declaration, if that's what you want. That said,

Strange error message from collections/sets.nim

2020-11-24 Thread Stefan_Salewski
> Use an editor that replaces tabs with whitespace. We have really discussed that topic enough in the last 5 years. For your point: Our intention is not to make the TAB key work. We regard tabs as the native, flexible entity for indentation, we would like that tabs survive in the code base. And

Strange error message from collections/sets.nim

2020-11-24 Thread solo989
Use an editor that replaces tabs with whitespace.

Strange error message from collections/sets.nim

2020-11-24 Thread Stefan_Salewski
> Oh not that again... That never worked for any codebase I've ever seen. That's what people said about significant whitespace until Python and a few others proved that its works fine. > constant friction when editing code ("oh no, I pressed a space, must undo and > use a tab") For me it is th

Strange error message from collections/sets.nim

2020-11-24 Thread Araq
> TABs for indentation, spaces for alignment. Oh not that again... That never worked for any codebase I've ever seen. Compressing 8 spaces with a tab was a common setting for emacs (iirc?) so in practice I was stuck for good with tab = 8 spaces. But even if it would work, it would be a constant