Re: Patch 8.1.0757

2019-01-17 Fir de Conversatie Bram Moolenaar


Yegappan wrote:

> On Tue, Jan 15, 2019 at 1:52 PM Bram Moolenaar  wrote:
> >
> >
> > Patch 8.1.0757
> > Problem:Not enough documentation for Blobs.
> > Solution:   Add a section about Blobs.
> > Files:  runtime/doc/eval.txt
> >
> >
> > *** ../vim-8.1.0756/runtime/doc/eval.txt2019-01-13 
> > 15:15:54.388762907 +0100
> > --- runtime/doc/eval.txt2019-01-15 22:48:29.185422882 +0100
> > ***
> > ! Part of a blob ~
> > !
> > ! A part of the Blob can be obtained by specifying the first and last index,
> > ! separated by a colon in square brackets: >
> > !   :let myblob = 0z00112233
> > !   :let shortblob = myblob[2:-1]   " get 0z2233
> > !
> > ! Omitting the first index is similar to zero.  Omitting the last index is
> > ! similar to -1. >
> > !   :let endblob = myblob[2:]   " from item 2 to the end: 0z2233
> > !   :let shortblob = myblob[2:2]" Blob with one byte: 0z22
> > !   :let otherblob = myblob[:]  " make a copy of the Blob
> > !
> 
> >
> > ! If the first index is beyond the last byte of the Blob or the second byte 
> > is
> > ! before the first byte, the result is an empty list.  There is no error
> >
> 
> Is this supposed to say "the second index is before the first index,
> the result is
> an empty list."?

Correct, I'll fix it.  I'll send out a runtime update with the fixes
soon.

-- 
hundred-and-one symptoms of being an internet addict:
231. You sprinkle Carpet Fresh on the rugs and put your vacuum cleaner
 in the front doorway permanently so it always looks like you are
 actually attempting to do something about that mess that has amassed
 since you discovered the Internet.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 8.1.0757

2019-01-16 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Tue, Jan 15, 2019 at 1:52 PM Bram Moolenaar  wrote:
>
>
> Patch 8.1.0757
> Problem:Not enough documentation for Blobs.
> Solution:   Add a section about Blobs.
> Files:  runtime/doc/eval.txt
>
>
> *** ../vim-8.1.0756/runtime/doc/eval.txt2019-01-13 15:15:54.388762907 
> +0100
> --- runtime/doc/eval.txt2019-01-15 22:48:29.185422882 +0100
> ***
> ! Part of a blob ~
> !
> ! A part of the Blob can be obtained by specifying the first and last index,
> ! separated by a colon in square brackets: >
> !   :let myblob = 0z00112233
> !   :let shortblob = myblob[2:-1]   " get 0z2233
> !
> ! Omitting the first index is similar to zero.  Omitting the last index is
> ! similar to -1. >
> !   :let endblob = myblob[2:]   " from item 2 to the end: 0z2233
> !   :let shortblob = myblob[2:2]" Blob with one byte: 0z22
> !   :let otherblob = myblob[:]  " make a copy of the Blob
> !

>
> ! If the first index is beyond the last byte of the Blob or the second byte is
> ! before the first byte, the result is an empty list.  There is no error
>

Is this supposed to say "the second index is before the first index,
the result is
an empty list."?

- Yegappan

>
> ! message.
> !
> ! If the second index is equal to or greater than the length of the list the
> ! length minus one is used: >
> !   :echo myblob[2:8]   " result: 0z2233
> !
> !

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 8.1.0757

2019-01-16 Fir de Conversatie Bram Moolenaar


> I see a typo and have some questions:
> 
> > ! To change a sequence of bytes the [:] notation can be used: >
> > ! let blob[1:3] = 0z445566
> > ! The length of the replaced bytes much be exactly the same as the value
> 
> Typo: much -> must
> 
> > ! To change part of a blob you can specify the first and last byte to be
> > ! modified.  The value must at least have the number of bytes in the
> range: >
> > ! :let blob[3:5] = [3, 4, 5]
> 
> Suddenly it's possible to specify longer sequences? The paragraph above
> prohibits this.

No, this was indeed a copy-paste leftover.

> Or is this paragraph a copy-paste leftover? Except for the length thing it
> seems to say almost the same thing as the previous one.
> Also the example uses a list as a replacement value, not a blob. Is it
> intentional? What if the list contains something other than what fits in
> bytes?

The value must be a blob, a list doesn't work.

> > + < *blob-identity* *E977*
> > + When variable "aa" is a Blob and you assign it to another variable
> "bb", both
> > + variables refer to the same Blob.  Then the "is" operator returns true.
> > +
> > + When making a copy using [:] or |copy()| the values are the same, but
> the
> > + identity is different: >
> > + :let blob = 0z112233
> > + :let blob2 = blob
> > + :echo blob == blob2
> > + < 1 >
> > + :echo blob is blob2
> > + < 1 >
> > + :let blob3 = blob[:]
> > + :echo blob == blob3
> > + < 1 >
> > + :echo blob is blob3
> > + < 0
> > +
> > + ! Making a copy of a list is done with the |copy()| function.  Using
> [:] also
> > + ! works, as explained above.
> 
> Wasn't this meant to say "copy of a blob" instead of "copy of a list"?

Yes, I'll fix it.

-- 
hundred-and-one symptoms of being an internet addict:
222. You send more than 20 personal e-mails a day.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 8.1.0757

2019-01-16 Fir de Conversatie Bram Moolenaar


Tony wrote:

> On Tue, Jan 15, 2019 at 10:52 PM Bram Moolenaar  wrote:
> >
> > Patch 8.1.0757
> > Problem:Not enough documentation for Blobs.
> > Solution:   Add a section about Blobs.
> > Files:  runtime/doc/eval.txt
> 
> Ah, this is much better.
> 
> I suppose the item at todo.txt lines 142-143 can now be removed.
> 
> I noticed one typo: at eval.txt line 1146:
> :let bs = b[]" copy ov 0zDEADBEEF
> "ov" should of course be "of".

Thanks.  Also "[]" should be "[:]".

-- 
Your fault: core dumped

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 8.1.0757

2019-01-16 Fir de Conversatie Marvin Renich
* Bram Moolenaar  [190115 16:52]:
> 
> Patch 8.1.0757
> Problem:Not enough documentation for Blobs.
> Solution:   Add a section about Blobs.
> Files:runtime/doc/eval.txt
[snip]
> ! Part of a blob ~
> ! 
> ! A part of the Blob can be obtained by specifying the first and last index,
> ! separated by a colon in square brackets: >
> ! :let myblob = 0z00112233
> ! :let shortblob = myblob[2:-1]   " get 0z2233

I would make the first example use an explicit non-(-1) index for the
last index, then after that say that -1 means the last element and give
this example.

...Marvin

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 8.1.0757

2019-01-15 Fir de Conversatie Tom M
Hi!

I see a typo and have some questions:

> ! To change a sequence of bytes the [:] notation can be used: >
> ! let blob[1:3] = 0z445566
> ! The length of the replaced bytes much be exactly the same as the value

Typo: much -> must

> ! To change part of a blob you can specify the first and last byte to be
> ! modified.  The value must at least have the number of bytes in the
range: >
> ! :let blob[3:5] = [3, 4, 5]

Suddenly it's possible to specify longer sequences? The paragraph above
prohibits this.
Or is this paragraph a copy-paste leftover? Except for the length thing it
seems to say almost the same thing as the previous one.
Also the example uses a list as a replacement value, not a blob. Is it
intentional? What if the list contains something other than what fits in
bytes?

> + < *blob-identity* *E977*
> + When variable "aa" is a Blob and you assign it to another variable
"bb", both
> + variables refer to the same Blob.  Then the "is" operator returns true.
> +
> + When making a copy using [:] or |copy()| the values are the same, but
the
> + identity is different: >
> + :let blob = 0z112233
> + :let blob2 = blob
> + :echo blob == blob2
> + < 1 >
> + :echo blob is blob2
> + < 1 >
> + :let blob3 = blob[:]
> + :echo blob == blob3
> + < 1 >
> + :echo blob is blob3
> + < 0
> +
> + ! Making a copy of a list is done with the |copy()| function.  Using
[:] also
> + ! works, as explained above.

Wasn't this meant to say "copy of a blob" instead of "copy of a list"?

Thanks.

Tom

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 8.1.0757

2019-01-15 Fir de Conversatie Tony Mechelynck
On Tue, Jan 15, 2019 at 10:52 PM Bram Moolenaar  wrote:
>
>
> Patch 8.1.0757
> Problem:Not enough documentation for Blobs.
> Solution:   Add a section about Blobs.
> Files:  runtime/doc/eval.txt

Ah, this is much better.

I suppose the item at todo.txt lines 142-143 can now be removed.

I noticed one typo: at eval.txt line 1146:
:let bs = b[]" copy ov 0zDEADBEEF
"ov" should of course be "of".

Best regards,
Tony.

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 8.1.0757

2019-01-15 Fir de Conversatie Bram Moolenaar


Patch 8.1.0757
Problem:Not enough documentation for Blobs.
Solution:   Add a section about Blobs.
Files:  runtime/doc/eval.txt


*** ../vim-8.1.0756/runtime/doc/eval.txt2019-01-13 15:15:54.388762907 
+0100
--- runtime/doc/eval.txt2019-01-15 22:48:29.185422882 +0100
***
*** 17,23 
  1.2 Function references   |Funcref|
  1.3 Lists |Lists|
  1.4 Dictionaries  |Dictionaries|
! 1.5 More about variables  |more-variables|
  2.  Expression syntax |expression-syntax|
  3.  Internal variable |internal-variables|
  4.  Builtin Functions |functions|
--- 17,24 
  1.2 Function references   |Funcref|
  1.3 Lists |Lists|
  1.4 Dictionaries  |Dictionaries|
! 1.5 Blobs |Blobs|
! 1.6 More about variables  |more-variables|
  2.  Expression syntax |expression-syntax|
  3.  Internal variable |internal-variables|
  4.  Builtin Functions |functions|
***
*** 53,59 
  StringA NUL terminated string of 8-bit unsigned characters 
(bytes).
|expr-string| Examples: "ab\txx\"--"  'x-z''a,c'
  
! List  An ordered sequence of items |List|.
Example: [1, 2, ['a', 'b']]
  
  DictionaryAn associative, unordered array: Each entry has a key and a
--- 54,60 
  StringA NUL terminated string of 8-bit unsigned characters 
(bytes).
|expr-string| Examples: "ab\txx\"--"  'x-z''a,c'
  
! List  An ordered sequence of items, see |List| for details.
Example: [1, 2, ['a', 'b']]
  
  DictionaryAn associative, unordered array: Each entry has a key and a
***
*** 72,78 
  
  Channel   Used for a channel, see |ch_open()|. *Channel* 
*Channels*
  
! Blob  Binary Large Object. Stores any sequence of bytes. *Blob*
Example: 0zFF00ED015DAF
0z is an empty Blob.
  
--- 73,80 
  
  Channel   Used for a channel, see |ch_open()|. *Channel* 
*Channels*
  
! Blob  Binary Large Object. Stores any sequence of bytes.  See |Blob|
!   for details
Example: 0zFF00ED015DAF
0z is an empty Blob.
  
***
*** 621,627 
:call map(dict, '">> " . v:val')  " prepend ">> " to each item
  
  
! 1.5 More about variables ~
*more-variables*
  If you need to know the type of a variable or expression, use the |type()|
  function.
--- 623,744 
:call map(dict, '">> " . v:val')  " prepend ">> " to each item
  
  
! 1.5 Blobs ~
!   *blob* *Blob* *Blobs* *E978*
! A Blob mostly behaves like a |List| of numbers, where the numbers have an
! 8-bit value, from 0 to 255.
! 
! 
! Blob creation ~
! 
! A Blob can be created with a |blob-literal|: >
!   :let b = 0zFF00ED015DAF
! 
! A blob can be read from a file with |readfile()| passing the {type} argument
! set to "B", for example: >
!   :let b = readfile('image.png', 'B')
! 
! A blob can be read from a channel with the |ch_readblob()| function.
! 
! 
! Blob index ~
!   *blob-index* *E979*
! A byte in the Blob can be accessed by putting the index in square brackets
! after the Blob.  Indexes are zero-based, thus the first byte has index zero. >
!   :let myblob = 0z00112233
!   :let byte = myblob[0]   " get the first byte: 0x00
!   :let byte = myblob[2]   " get the third byte: 0x22
! 
! A negative index is counted from the end.  Index -1 refers to the last byte in
! the Blob, -2 to the last but one byte, etc. >
!   :let last = myblob[-1]  " get the last byte: 0x33
! 
! To avoid an error for an invalid index use the |get()| function.  When an item
! is not available it returns -1 or the default value you specify: >
!   :echo get(myblob, idx)
!   :echo get(myblob, idx, 999)
! 
! 
! Blob concatenation ~
! 
! Two blobs can be concatenated with the "+" operator: >
!   :let longblob = myblob + 0z4455
!   :let myblob += 0z6677
! 
! To change a blob in-place see |blob-modification| below.
! 
! 
! Part of a blob ~
! 
! A part of the Blob can be obtained by specifying the first and last index,
! separated by a colon in square brackets: >
!   :let myblob = 0z00112233
!   :let shortblob = myblob[2:-1]   " get 0z2233
! 
! Omitting the first index is similar to zero.  Omitting the last index is
! similar to -1. >
!   :let endblob = myblob[2:]   " from item 2 to the end: 0z2233
!   :let shortblob = myblob[2