[vim/vim] Vim9script internals, how to read the source code and in what order (Discussion #13543)

18 views
Skip to first unread message

stefanos

unread,
Nov 18, 2023, 6:14:39 AM11/18/23
to vim/vim, Subscribed

I'm fascinated by programming languages and I always find myself digging deep in their internals to learn how each creator implements specific language features they may find interesting.

In case of Vim's scripting language, how do I read the source code to familiarize myself with it?

With the implementation of vim9script, I can see we have added "primitive" types and class objects and I would like to see how they have improve the whole performance and / or what type of bytecode or native code they generate behind the scenes.

Are there any plans to write in the near future anything like PHP's internals book?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/13543@github.com>

Yegappan Lakshmanan

unread,
Nov 18, 2023, 10:37:38 AM11/18/23
to vim...@googlegroups.com, reply+ACY5DGF3HD3RLUFED5...@reply.github.com, vim/vim, Subscribed
Hi,

On Sat, Nov 18, 2023 at 3:14 AM stefanos <vim-dev...@256bit.org> wrote:

I'm fascinated by programming languages and I always find myself digging deep in their internals to learn how each creator implements specific language features they may find interesting.

In case of Vim's scripting language, how do I read the source code to familiarize myself with it?



With the implementation of vim9script, I can see we have added "primitive" types and class objects and I would like to see how they have improve the whole performance and / or what type of bytecode or native code they generate behind the scenes.


Only code in def functions are compiled and converted to bytecode.  You can use the 'defcompile'
and 'disassemble <def function name>' command  to see the generated bytecode.  Example:

vim9script

def Foo()
   var i = 10
   i = i + 20
enddef
defcompile
disassemble Foo
 

Are there any plans to write in the near future anything like PHP's internals book?


There are currently no plans to write an internal book.

Regards,
Yegappan

vim-dev ML

unread,
Nov 18, 2023, 10:37:55 AM11/18/23
to vim/vim, vim-dev ML, Your activity

Hi,

On Sat, Nov 18, 2023 at 3:14 AM stefanos ***@***.***> wrote:

> I'm fascinated by programming languages and I always find myself digging
> deep in their internals to learn how each creator implements specific
> language features they may find interesting.
>
> In case of Vim's scripting language, how do I read the source code to
> familiarize myself with it?
>

With the implementation of vim9script, I can see we have added "primitive"
> types and class objects and I would like to see how they have improve the
> whole performance and / or what type of bytecode or native code they
> generate behind the scenes.
>

Only code in def functions are compiled and converted to bytecode. You can
use the 'defcompile'
and 'disassemble <def function name>' command to see the generated
bytecode. Example:

vim9script

def Foo()
var i = 10
i = i + 20
enddef
defcompile
disassemble Foo


> Are there any plans to write in the near future anything like PHP's internals
> book <https://www.phpinternalsbook.com/>?
>
>
> There are currently no plans to write an internal book.

Regards,
Yegappan


Reply to this email directly, view it on GitHub,.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/13543/comments/7607050@github.com>

stefanos

unread,
Nov 18, 2023, 2:47:37 PM11/18/23
to vim/vim, vim-dev ML, Mention

Thank you @vim-ml for your valuable reply!


Reply to this email directly, view it on GitHub,.
You are receiving this because you were mentioned.Message ID: <vim/vim/repo-discussions/13543/comments/7608055@github.com>

Reply all
Reply to author
Forward
0 new messages