Hi Bram,

> - When Vim was compiled with Python 2.x ":py3" gives an error
> - When Vim was compiled with Python 3.x ":python" gives an error
> - When Vim was compiled with both 2.x and 3.x both commands work

or put differently:

if (command starts with :py)
        - following digits are interpreted as part of the command
                and an error results if the command is not available
        - this entails that a :pyxxx command must end in non-letter and 
non-digit (but still allows '.',',','+',...)
 
And we accept the potential problems mentioned earlier.

If that's fine for you, it's fine for me, too.
I will do the changes and send a patch to vim_dev.

Roland


[email protected] schrieb am 03.09.2009 13:13:27:
> 
> Roland Puntaier wrote:
> 
> > Hi Bram,
> > 
> > > Having two Vim executables is a bad idea.  Next you have two 
versions of
> > > Perl, small and big features, etc.  You end up with many different 
Vim
> > > executables.  It's better to try and have one executable.
> > 
> > OK, let's have both python2.x and python3.x.
> > 
> > But let's get a common understanding first.
> > Then, if you feel comfortable to integrate that in the official 
sources,
> > I can do the changes needed.
> > 
> > > It's a lot easier if the Python script itself specifies what version 
of
> > > Python it is for.  E.g., by something in the first line.  Then one 
can
> > > use the ":python" command and get an error if the Python version 
doesn't
> > > match.  If it would be possible to build Vim with both Python 2.x 
and
> > > 3.x then it would always work.
> > 
> > Now I understand what you mean:
> > the vim python command gets dispatched to a C function that pre-scans 
to 
> > see
> > which python version to use 
> > and then calls the according ex_python() or ex_python3() C functions.
> > 
> > First thought: For single line statements one could use a simple "3" 
to 
> > decide.
> > But note: '3+X' is a valid python expression which could change X.
> > Lagacy ':python3+X' would then suddenly be forwarded to python3 as 
'+X',
> > which is also valid. This could all get undetected.
> > 
> > So 3 cannot be used to distinguish.
> 
> Hmm, annoying.  We should have required white space after the command.
> We could require that now.  That still has the problem that this is
> valid: ":python3 +X"
> And would be interpreted in current Vim as ":python 3 +X"
> But do we really care?
> 
> I actually can't think of a useful Python command that starts with 3.
> You can have a valid command like ":py3+4", but it has no effect, so it
> should not actually be used.  Is there anything else than an expression
> that starts with the number 3?
> 
> To be as backwards compatible as possible, we would require white space
> after ":python3", but ":pythonXXX" would still be accepted.  XXX would
> need to start with a non-letter, but not a 3.  To stay on the safe side
> we should not accept any number.
> 
> > And anyway, there is no big difference from script solution to having 
two 
> > commands. 
> > (Please comment)
> > 
> > 
> > I suggest a new command for python 3.
> > 
> > My favourite currently
> >         :PYTHON
> > I know that this is contrary to the policy to use small letters for 
> > builtin ex commands,
> > but :py3 and :python3 would have problems like the one mentioned 
above.
> > (:_python possibly would do, too.) 
> > (please comment)
> 
> Upper case letters are reserved for user commands.  Breaking this
> convention makes things too complicated and confusing.
> 
> An alternative would be ":pythonthree".  But that looks ugly.
> ":pythree" is not nice either.
> 
> Perhaps we should use ":py3", with the requirement that white space
> follows.  It's not perfect, but probably the best compromise.
> Is ":py_3" better?  Looks strange.
> 
> - When Vim was compiled with Python 2.x ":py3" gives an error
> - When Vim was compiled with Python 3.x ":python" gives an error
> - When Vim was compiled with both 2.x and 3.x both commands work
> 
> 
> -- 
> hundred-and-one symptoms of being an internet addict:
> 179. You wonder why your household garbage can doesn't have an
>      "empty recycle bin" button.
> 
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net 
\\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ 
\\\
> \\\        download, build and distribute -- http://www.A-A-P.org ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org ///


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

Raspunde prin e-mail lui