Re: [fpc-devel] Method for write string into TStreamt

2014-07-21 Thread Hans-Peter Diettrich
Dmitry Boyarintsev schrieb: How about introducing a default parameter? The parameter keeps the method backward compatible, allowing write a string without the prefix. public procedure TStream.WriteAnsiString( const S: string; withLength: Boolean = true; How should a string without a leng

Re: [fpc-devel] Syntax choice (was: Blocks support)

2014-07-21 Thread Sven Barth
Am 21.07.2014 18:15 schrieb "Dmitry Boyarintsev" : > > On Sun, Jul 20, 2014 at 6:28 PM, Jonas Maebe wrote: >> >> It's also a similar concept (you have a pointer to something that describes a function), but it's incompatible and different so you need a different syntax. Any different syntax is fine

Re: [fpc-devel] Syntax choice (was: Blocks support)

2014-07-21 Thread Dmitry Boyarintsev
On Sun, Jul 20, 2014 at 6:28 PM, Jonas Maebe wrote: > > I proposed to use "is block" because of the analogy with the already > existing "is nested". Neither "block" nor "nested" was/is/would be a > reserved word afterwards, just like many other words that have a special > meaning in one context o

Re: [fpc-devel] Method for write string into TStreamt

2014-07-21 Thread Sven Barth
Am 21.07.2014 11:34 schrieb "Marco van de Voort" : > > In our previous episode, Sven Barth said: > > > Do you think, that something similar can be added also in FPC ? > > > > There is already a WriteAnsiString ( > > http://www.freepascal.org/docs-html/rtl/classes/tstream.writeansistring.html > > )

Re: [fpc-devel] Method for write string into TStreamt

2014-07-21 Thread Dmitry Boyarintsev
How about introducing a default parameter? The parameter keeps the method backward compatible, allowing write a string without the prefix. public procedure TStream.WriteAnsiString( const S: string; withLength: Boolean = true; ); thanks, Dmitry On Mon, Jul 21, 2014 at 5:34 AM, Marco van de V

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread LacaK
Marco van de Voort wrote / napísal(a): In our previous episode, Michael Van Canneyt said: Nothing stops you though from writing a class helper that adds a WriteString method to TStream. Yes, I can create also own descendant etc. ... but I am asking for general solution, which will b

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > > Nothing stops you though from writing a class helper that adds a > > WriteString method to TStream. > > > > Yes, I can create also own descendant etc. ... but I am asking for general > > solution, which will be useful for all. > > Sur

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread Michael Van Canneyt
On Mon, 21 Jul 2014, LacaK wrote: Sven Barth  wrote / napísal(a): Am 21.07.2014 10:29 schrieb "LacaK" : > > Hi, > When I work with f.e. TFileStream I need often write string into stream. > Now I use: >  Stream1.WriteBuffer(s[1], length(s)); > >

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread LacaK
Sven Barth wrote / napísal(a): Am 21.07.2014 10:29 schrieb "LacaK" >: > > Hi, > When I work with f.e. TFileStream I need often write string into stream. > Now I use: > Stream1.WriteBuffer(s[1], length(s)); > > I think, that for convenience it will be useful having some

Re: [fpc-devel] Method for write string into TStreamt

2014-07-21 Thread Marco van de Voort
In our previous episode, Sven Barth said: > > Do you think, that something similar can be added also in FPC ? > > There is already a WriteAnsiString ( > http://www.freepascal.org/docs-html/rtl/classes/tstream.writeansistring.html > ) with the difference that it also writes out the length. Adding a

Re: [fpc-devel] Method for write string into TStream

2014-07-21 Thread Sven Barth
Am 21.07.2014 10:29 schrieb "LacaK" : > > Hi, > When I work with f.e. TFileStream I need often write string into stream. > Now I use: > Stream1.WriteBuffer(s[1], length(s)); > > I think, that for convenience it will be useful having something like: > procedure TStream.WriteString(const s: string);

Re: [fpc-devel] Syntax choice (was: Blocks support)

2014-07-21 Thread Michael Schnell
On 07/20/2014 10:27 PM, Dmitry Boyarintsev wrote: There's no "block" reserved word in FPC yet (unlike mentioned earlier Oxygen). AFAIU, many keywords are not reserved, but recognized only due to their context. Hence somebody could have used "block" as a normal symbol. But "in block" is compati

[fpc-devel] Method for write string into TStream

2014-07-21 Thread LacaK
Hi, When I work with f.e. TFileStream I need often write string into stream. Now I use: Stream1.WriteBuffer(s[1], length(s)); I think, that for convenience it will be useful having something like: procedure TStream.WriteString(const s: string); begin WriteBuffer(s[1], length(s)*sizeof(char);