Questions about Nim and its extensibility

2022-10-28 Thread phantomcraft
@dsrw > You could have a macro that took a filename as a parameter, read the file, > ran it through a parser of some sort, then used the parse tree to generate > Nim code which would be compiled into your program. Awesome, it means that Nim is a language with almost infinite possibilities. > I

Evolving the GUI definition

2022-10-28 Thread grd
I only tried to make a picture, but you quoted the wrong parts of my picture. I will explain what is wrong today: Do you know prof Wirth? You probably know that he created Pascal. What not a lot of guys know is that after he created Pascal he continued with new languages, Modula and after that h

Questions about Nim and its extensibility

2022-10-28 Thread dsrw
> As @dsrw said, it's possible to write a sub-language in Nim, this is very > interesting. You could have a macro that took a filename as a parameter, read the file, ran it through a parser of some sort, then used the parse tree to generate Nim code which would be compiled into your program. It

Questions about Nim and its extensibility

2022-10-28 Thread phantomcraft
@Araq > No as there are no reader macros in Nim but the better (IMO anyway) > alternative is to have a compile-time parser that operators on string > literals. Sorry for my ignorance, I'm not a experienced Python programming, what I do is just some tools for doing somethings in my system; can

Owlkettle 2.0.0 is a declarative GUI framwork for GTK 4

2022-10-28 Thread can-lehmann
# Owlkettle 2.1.0 A [new release was published](https://github.com/can-lehmann/owlkettle/releases/tag/v2.1.0)! Check it out on [GitHub for the full changelog](https://github.com/can-lehmann/owlkettle/releases/tag/v2.1.0). Here is a summary of the changes: * The style used for identifiers wa

Question about patterns

2022-10-28 Thread Hlaaftana
`(~x){y}` seems to mean "capture `y` as long as it is not `x`". So template foo{x = (~x){y}}(x, y: untyped) = echo "got ", astToStr(x), " and ", astToStr(y) var a = 1 var b = 2 a = b a = a b = a b = b Run outputs got a an

Question about patterns

2022-10-28 Thread EnteryName
I do understand how this pattern is evaluated: template t{0|1}(): untyped = 3 Run But I can't figure out how this one is processed: template t{x = (~x){y} and (~x){z}}(x, y, z: bool) = x = y if x: x = z var a = false b = tr

Evolving the GUI definition

2022-10-28 Thread Stefan_Salewski
> summary of Nim GUI's libraries. Actually we have more than 20 currently. See list just above this heading: I have recently added the www links.

Evolving the GUI definition

2022-10-28 Thread dlesnoff
@grd I need some precisions to understand fully your opinion. > That is why we today need to live with C++ and C, and Windows, and the WWW > and you name it. What's the problem with it ? They might all seem old technologies WWW being very different from an the OS Windows, and the two languages.

Evolving the GUI definition

2022-10-28 Thread cblake
Lol. Lately I have been phrasing this as: Delegation can save so much, but trust is also tricky!

Owlkettle 2.0.0 is a declarative GUI framwork for GTK 4

2022-10-28 Thread can-lehmann
Thank you for your kind words and of course for contributing to the project!

Evolving the GUI definition

2022-10-28 Thread catswhiskers
What you are describing is the paradigm of all human endeavours.

Calling conversions for C macros

2022-10-28 Thread demotomohiro
If C functions you want to import are declared with specific calling convention, you would need to import them with same calling convention. If you import C functions using header pragma, you would not need to specify calling convention. C ma

Nimscript and GPL

2022-10-28 Thread federico3
@sls1005 it's common to include a file named LICENCE or COPYING at the root of a repository to **hint** that all files in the project are under the same license unless stated otherwise. A safer option is to also include a little header on top of every file, for better clarity. You are not requi

Calling conversions for C macros

2022-10-28 Thread sls1005
If you `importc` a proc, should you specify its calling conversion? Which one should it have if it's a C macro? Is it `cdecl`, `inline` or `noconv`?

Tips on how to avoid Nim pointer instability bugs?

2022-10-28 Thread demotomohiro
Related Github issue:

Tips on how to avoid Nim pointer instability bugs?

2022-10-28 Thread Hlaaftana
This gives an assertion error on , unless you are using the development version. If you change `Foo` to `object` instead of `ref object` then assertion passes as expected. If it persists, I'm guessing it might be a C compiler issue. But I'm not sure.

Nimscript and GPL

2022-10-28 Thread sls1005
OK, thanks.

Is it possible to allocate ref objects in a specific region of memory?

2022-10-28 Thread Araq
> I'd like to use an arena allocator to allocate ref object s (for spatial > locality) Nim's allocator already understands the importance of "spacial locality". > but I lose the ability to that with library types. Yes indeed. It also does not matter. The parts of the stdlib that allocate heavi

Nimscript and GPL

2022-10-28 Thread Araq
Nim is MIT, not GPL v3, not sure if there is some confusion here? I'm not a lawyer but code generated by Nim's tools falls under the same licence that you chose for your project. So if your project is GPL 3, so is your config.nims. Same for the makefile if you wrote it or niminst generated it fo

Tips on how to avoid Nim pointer instability bugs?

2022-10-28 Thread exelotl
Are there existing issues on github to keep track of these cases? You should definitely create them if not.

Evolving the GUI definition

2022-10-28 Thread grd
If you want to have my opinion, I need to say that my opinion differs from a lot of other guys. The problem is that way too many guys want the best idea built, but they never ever think about the consequences about their ideas. That is why we today need to live with C++ and C, and Windows, and

Nimscript and GPL

2022-10-28 Thread sls1005
By the definition of GPL v3, is the `config.nims` of a GPL'ed Nim project considered a part of the software? Also, is the makefile considered a part of it? Shall these scripts be licensed under the same license?

Evolving the GUI definition

2022-10-28 Thread pietroppeter
Haha, you are perfectly right! I will try to update the document! Thanks for the remark, this looks like it is driving the original point home :)

Tips on how to avoid Nim pointer instability bugs?

2022-10-28 Thread japplegame
Another example of weird code generating a weird result type Foo = ref object flag: bool var test = Foo() proc setFlag(flag: var bool) = test = Foo() flag = true setFlag(test.flag) assert(test.flag, "how could this happen?")

Evolving the GUI definition

2022-10-28 Thread pietroppeter
hey, wait, it seems that there is an easy to reach fix (update blogpost): nbKaraxCode: const helloId = "helloId" inputId = "inputId" var hello = "welcome to the hello program" name = "" exited = false karaxHtml: if exit

Evolving the GUI definition

2022-10-28 Thread dlesnoff
You don't handle the `exit` word at all. In the input section, you will probably have to add an if case to output the "Thanks for playing" part. I guess the problem in the conversion is the way you end the program. Do you hide the button, once exit has been given as input ? Do you leave the butt

Evolving the GUI definition

2022-10-28 Thread pietroppeter
> try converting the following imperative script even by hand: interesting challenge! this is my solution using nimib's `nbKaraxCode` (karax without boilerplate): nbKaraxCode: const helloId = "helloId" inputId = "inputId" var hello = "welcome to t

Evolving the GUI definition

2022-10-28 Thread ingo
What if, every widget is an executable, is written using what ever gui lib, tied together using a lightweight inter-process bus to present itself as a singe app for inspiration, look at DAW's and their VST's, AU's etc. then, forget about native look and feel. Applications should be written to t

Tips on how to avoid Nim pointer instability bugs?

2022-10-28 Thread Araq
> But if it's something that should have been safe (like var T), then it's a > problem, because everyone use it carelessly, thinking they're on the safe > side. Correct, the rules should patch the memory-safe subset of Nim.