On 7月16日, 上午2时08分, mobi phil <[email protected]> wrote:
> what about redesigning things with c++, with powerful design patterns,
> eventually avoiding STL ? :)( I am smiling, as not everything should be
> taken to seriously :) )
>

hehe, but C is a more wise choice:
  - it's better portable than C++.
  - it simple than C++, that makes port more easy.
  - original-Vim is written with C. and I planed to accept most of
codes of Vim, just make a more flexible framework.
  - the framework contains a script language which must run fast, C &
yacc is a better choice.
  - we can't get benefits from C++.


> Actually it is not necessary to redesign it with c++, would be enough to try
> to redesign it with
> having more in mind the concept of interfaces.

yes, that's our purpose. first we must build a framework for each main
function of Vim (operator, option system, command-line, insert-mode,
syntax-highlight, fold, window/tab, memory-block(not memory line,
because I prefer use block to manage memory, not logical line.), and
locale/i18n, char-set/encoding, etc.), we define expendable data-sheet
and simple interface for them, and design the interaction with script
(new script should can control every face of Vim).

then, we pick old-vim's code, fix them in it, and write script code
for function than needn't speed.


> About states: I would create even more states. One should design o mode
> to enumerate states, and their
> commands and key bindings.

what is a state? I think a state is a interface you have different way
to communicate with Vim. so state is the less the better. (the
interface is the same, eventually then appeared in different event :-)

first of all, we need a normal mode, in this mode, we can execute
command by press a operator (yes, ':', '/', etc are all operator in my
concept), when we input 'c', we enter another normal mode with
different operators. then we input 'a', then we in another normal
mode. that will make coding decrease rapidly. each mode has its name
and maps and operators, we can pass them to a same function, and get
them work.

then, we need a input mode. normal mode is defined to " a mode accept
a number and a key (a operator), and do something with this key)", and
input mode defined as "a mode used to input a serial of charactor",
that means all text we input are literally except some "special keys",
they are used to modify the text directly. some key, like <UP>, are
not used to modify the text, so they are "exit key", used to exit
insert mode. In my concept, "abc<LEFT>def" is in a insert mode
(because of move is in text, for modify), and "abcdef<RIGHT>g" are not
one insert mode, they are two insert mode execute. one is "abcdef",
then we press <RIGHT> and it returned to caller, caller open a new
insert mode to handle "g". there are two insert mode.

that's all. we only need two "true" mode. that only need two "core"
function to process it, the maps, operators, special-keys, etc. are
all the argument of this two funciton (in a struct). we use this
struct to handle all status of mode.

in these struct, all functions can be script function or hard-code
function, we must make a mechanism to implement fast call on them.

beside the core (gui/terminal hardware-abstract-level(hal), a middle-
level script system, resource handle/manage system and two core
function above), all functions are services, they must be reentrant,
and can replaced by dynamic-loaded-library or script code/bytecode.
that means we use C maked a pure object-oriented system. so we needn't
C++.

btw, all data (struct) except temporary one, all need ref-count, to
prevent memory-leaks. and for multi-use purpose. that is also
important. they are all handle by resource system (except static data
and temporary data).

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui