Re: Nim forum features

2018-09-20 Thread mmierzwa
@Araq Thank you. Of course it was my mistake. I used wrong account and that list was just empty. @juancarlospaco Thanks. Why I did not get that idea myself... ;)

Re: Version 0.17.0 released!

2017-05-20 Thread mmierzwa
First of all. Congratulations. > But you're spot on, I hope this feature means we can remove method from the > language. If you do, you may consider put some words into documentation what to do to achieve similar behaviour because there is quite a lot of people that are comfortable with that a

Re: How not to use methods

2017-03-15 Thread mmierzwa
Jonathan Blow is creating this language and compiler and actually as testing he is making a game in it. There you can declare things as SOA or AOS (struct of arrays or array of structs). I encourage you to visit his videos sessions on youtube. So it exists but is not available yet.

Re: How not to use methods

2017-03-15 Thread mmierzwa
Thank you for your explanation. Whereas I can understand I am not good at applying this knowledge in practise. First lets take a look at object variant polymorphism. It can do the same as methods but then cases sneak everywhere which is ugly. Then, let me elaborate more. There are entities. Enti

Re: Immutable sequence

2017-03-14 Thread mmierzwa
Thank you. From my examples also I realized that I am tending to mix reference semantics with value semantics which lead to quite frustrating bugs.

Immutable sequence

2017-03-14 Thread mmierzwa
I have found such example when seq is immutable type B* = object myseq: seq[int] type A* = object bseq*: seq[B] proc test1() = var b: B b.myseq = newSeq[int]() var i = 0 while i < len(b.myseq): if

Re: How not to use methods

2017-03-11 Thread mmierzwa
Yes. First I am afraid they could remove them, second and more important, it means they do such things in different way which I would like to learn.

Re: How not to use methods

2017-03-11 Thread mmierzwa
Thank you. Would you mind to present "colsure" solution? The one you suggested would not be feasible as every entity can have various nubmer of various components.

How not to use methods

2017-03-11 Thread mmierzwa
Hi I need a hint. Provided I have such construction type Component = ref object of RootObj type Entity = ref object components = seq[Component] method update(c: Component) = discard Then, I have components, like: type Fighter = ref object

Method does not work, implicit generic?

2017-03-11 Thread mmierzwa
Hi I have had hard time with method which did not behave as I expected to. child.nim type Parent* = ref object of RootObj type Child* = ref object of Parent type Some = object method getDataToSave*(x: Parent): object {.base.} = echo("took getDataToSave Pare

Re: 7drl - Seven Day Roguelike Game Dev Competition

2017-03-02 Thread mmierzwa
I do not know the rules. But if anyone would like to write it in Nim I would be happy to join. Recently I was working on something that resemble Roguelike: [Not Roguelike!](https://dl.dropboxusercontent.com/u/21455945/NotRoguelike.GIF)

Re: Atom/Sublime with recent versions of nimsuggest

2017-03-02 Thread mmierzwa
Sublime works decent with nimlime. However it was recently abandoned so I am a bit worried.

Re: Nim video tutorials

2017-02-25 Thread mmierzwa
Great idea. Rather short videos focused on particular subject. Worth mentioning is basics, how to install, how to use, hello world, then syntax, datatypes, object model, ref and without ref. More advanced topics could cover generics, templates, marros. Now please bear in mind that I am not parti

Re: Nim Syntax ''Skins''

2017-02-23 Thread mmierzwa
Just remark. In SQL Server for instance you can design query graphically but everyone (in my experience) just write it in text. I am trying to say that it would not be easy to go to higher level of abstraction. Graphical languages are not very popular. Human is a beast which thinks rather sequen

Re: Nim Syntax ''Skins''

2017-02-22 Thread mmierzwa
I think that also the question is whether we (you rather) are making practical language or academic one. I am not sure if both can be successfully combined (although such approach worked for pypy they say). Endow language with all shiny, "it is how it should be" etc. concepts, which can by the w

Re: Nim Syntax ''Skins''

2017-02-22 Thread mmierzwa
While I agree with everything what Libman says I am also a bit afraid. * syntax wars will not be ceased in peaceful Nim world, they will be drag inside Nim world * Nim already allows using quite different styles. And it happens quite often that I am looking at someone's code and it take me t

Re: Why `..` does not work for countdown

2017-02-20 Thread mmierzwa
>From system.nim iterator `..`[S, T](a: S; b: T): T {..} An alias for countup. Source Edit Anyway, could not it work with a > b? Probably there is some reasoning behind this and I am trying to understand.

Why `..` does not work for countdown

2017-02-20 Thread mmierzwa
Hi I have been wondering why _`..`_ operator works only for _countup_. Why there is no counterpart for _couontdown_? For instance something like: when sizeof(int) <= 2: type IntLikeForCount = int|int8|int16|char|bool|uint8|enum else: type IntLikeForCount = int|

File, FileDescriptor, Handle, Windows

2017-02-17 Thread mmierzwa
Hi I would like to ask you for help again. I am trying to achive double buffering for console under Windows (I was in shock when I noticed that there is double buffering for console). My current code: import winim from os import execShellCmd, sleep var buffer1: HANDL

Re: How to be more concise in code [NEWBIE]

2017-02-16 Thread mmierzwa
Thank you. Will take a look. I am looking for simple solutions. Patty is for sure marvellous but 400 lines (or so) of code to emit few lines of code is intimidating to me.

Re: How to be more concise in code [NEWBIE]

2017-02-16 Thread mmierzwa
So final version from my first post would now look like: (I took variantp from andrea's patty and added my version of match) template match*(t: typed, handlers: openArray): untyped = var x = ord(t.kind) handlers[x](t) message.nim import patty

Re: How to be more concise in code [NEWBIE]

2017-02-16 Thread mmierzwa
Thank you **andrea**. I like your _variant_ but _match_ is for me similar in verbosity to my getText and I think it could be compressed further. My attempt: import patty variant Message: hit(hp: int) death(died: string) proc hhit(m: Message) = echo

How to be more concise in code [NEWBIE]

2017-02-16 Thread mmierzwa
Hi I needed some sort of polymorphism, but did not want to use inheritance and methods because it needs heap allocation and I have quite small objects which are created and destroyed frequently. Finally I came out with setup which I was comfortable with, and here is example: message.nim

Re: messaging - or communicating between GUI's

2017-01-28 Thread mmierzwa
Thank you **god**. data[][0].addr was what I was looking for, tried to use repr to check but it turned out unreliable and so my confusion. So **Araq** was right, I was trying to send pointer, but I could not find from his answer where I made it wrong.

Re: var param vs tuple as return value

2017-01-28 Thread mmierzwa
I know. Closed. I am sorry but let me add last quick remark. Such discussions, even when look somewhat as a fight, are not necessarily bad thing. It is good to see some other people opinions as long as they are backed up with constructive arguments. So if it is possible to make section for my qu

Re: messaging - or communicating between GUI's

2017-01-27 Thread mmierzwa
My understanding is that I **do not** send pointer but I give address of start of memory from which pipe should send the data of bytes length. And the pipe is to cross the processes barrier. Also I have no idea how or what could I use from stdlib.

Re: messaging - or communicating between GUI's

2017-01-27 Thread mmierzwa
So I modified god's example. The main differrence is that server receives data and client pushes and data should be string. Unfortunatelly after many many hours i gave up and would like to ask you for help again. I feel I am doing something terrible with strings and its places in memory. server

Re: [newbie question] Pointer to cstring

2017-01-27 Thread mmierzwa
Thank you Krux and Araq. repr is very useful to be able to understand what is going on in my program. I am trying to send strings through a pipe (without success) so casting to pointer and knowing what is exactly happening is crucial for me.

[newbie question] Pointer to cstring

2017-01-26 Thread mmierzwa
Hi I am having hard time understanding pointers, addr, cstrings. var i: cstring = "a" var pi: ptr cstring = i.addr echo repr(i) echo repr(pi) Output: 005BC058"a" ref 004477F8 --> 005BC070"a" My understanding is this. First we declare variabl

Re: messaging - or communicating between GUI's

2017-01-26 Thread mmierzwa
Thank you for your reply **Krux02**, I appreciate it. Not quite there however because what I am interested in is processes not threads and how to set up communication between two. Also I am looking for pipes, shared memory, ffs and differences among them, performance etc. I do not want to setup

Re: messaging - or communicating between GUI's

2017-01-25 Thread mmierzwa
Could you paste your solution (the IPC part) for future reference?

Re: var param vs tuple as return value

2017-01-25 Thread mmierzwa
Thank you. I will use this IRC bridge. Anyhow, I feel forum is a lot better for even newbie questions. If language becomes more popular you will have the same questions asked again and again in IRC whilst they should be easy discoverable in forum (like in stackoverflow), this could serve as addi

Re: How to open new console window and File, FileInfo, FileHandle

2017-01-25 Thread mmierzwa
When I am in forum view I see there are 4 answers in this thread and I see also AironGregatti. However when I enter I see only 3 posts without that from Airon. Why is this so? Moderation?

Re: var param vs tuple as return value

2017-01-25 Thread mmierzwa
Hi "Btw please join IRC or gitter instead of flooding this forum with newbie questions, no offense." I do not want to flood your forum, but I do realize my questions would be newbie as well. The problem is, if I use irc-like I have chance to get answer only from people who are already online/r

Re: Exploring namespaces support in Nim

2017-01-24 Thread mmierzwa
Andrea, whilst its true, it is on library creator side, whilst we may want to decide how it would look like in our code, when there are two libraries where their creators did not use distinct type.

How to open new console window and File, FileInfo, FileHandle

2017-01-24 Thread mmierzwa
Hi I am trying to open new console window and be able to write to it. My attempts failed. How to do that? (currently using MinGW) During my attempts I tried to create process using startProcess I noticed that I can get then FileHandle for process. However I do not know how obtain File to which