Marc Weber wrote:

> Well - I don't want to discuss the topic.
> 
> I just want to know how to do basic stuff "the Vim way" efficiently.
> 
> C++ is not perfect, and probably its easiy to get things wrong.
> But at least it provides standard ways for standard tasks, such as
> arrays/vectors/maps/hashes whatsoever.
> 
> Eg buffer.c contains:
> 
> 
>       /*
>        * put new buffer at the end of the buffer list
>        */
>       buf->b_next = NULL;
>       if (firstbuf == NULL)           /* buffer list is empty */
>       {
>           buf->b_prev = NULL;
>           firstbuf = buf;
>       }
>       else                            /* append new buffer at end of list */
>       {
>           lastbuf->b_next = buf;
>           buf->b_prev = lastbuf;
>       }
>       lastbuf = buf;
> 
> 
> which is not bad. But if you need the same feature again: a linked list
> like whatsoveer structure, it looks like the standard way is to write
> the same code again. Its taking programmers time and is more likely to
> be wrong.
> 
> I personally don't want to spend time on thinking about how to use
> malloc, realoc or such for simple things like lists, maps, ...
> 
> Thus is there a standard way, a preprocessor like library which gets the
> job done? something like:
> 
>     define_list(vim_buffer);
> 
> providing functions like
>     vim_buffer_list_new()
>     vim_buffer_list_add(...)
>     vim_buffer_list_remove(...)
> 
> ?

Yeah, basic C is missing containers.  There are libraries for them, but
there doesn't seem to be one clear winner.

> Does it make sense to port Vim to C++, just to use some very basic C++
> like features, such as vector, map and so on?
> If not - can we document why?

C++ is incredibly complex.  The specification is 2000 pages.  Only the
top programmers can write C++ code that works properly.  And then still
make hard-to-debug mistakes.  It's my daily work, I know what I'm
talking about.

Java is a lot easier to work with, but has too much overhead and is very
resource-hungry.


> I know that Vim has a long history, but the future of Vim is likely to
> be longer than its history.
> 
> Does Vim run on any platforms only supporting C, not C++?
> 
> Sorry for having to ask such a stupid question. Its about simple
> features like "make vim populate quickfix in realtime, so that the 4sec
> issue I talked about goes away".
> 
> I expect that Vim's future will be longer than its (long) history was.
> So its worth using simple improvements, too.
> 
> If you think this question is nonsense, make me understand why.
> 
> So which is the reason sticking to C only, and which is the reason not
> introducing a template library for simple things like lists?
> 
> If moving to C++ is not an option, but moving ot a tmeplate library is,
> is there one you would recommend?
> 
> I want to have a native implementation for vim-addon-async for example.

The solution I've been thinking of is www.zimbu.org.
It produces C code, thus there should be a way to mix some parts written
in Zimbu and some parts still written in C.

-- 
In a world without walls and borders, who needs windows and gates?

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui