Jump to page: 1 216  
Page
Thread overview
Proposal for SentinelInputRange
Feb 28, 2013
Walter Bright
Feb 28, 2013
Timon Gehr
Feb 28, 2013
John Colvin
Feb 28, 2013
Timon Gehr
Feb 28, 2013
Zach the Mystic
Feb 28, 2013
Walter Bright
Feb 28, 2013
Zach the Mystic
Feb 28, 2013
Walter Bright
Feb 28, 2013
Zach the Mystic
Feb 28, 2013
Walter Bright
Feb 28, 2013
deadalnix
Feb 28, 2013
Walter Bright
Feb 28, 2013
deadalnix
Feb 28, 2013
Walter Bright
Feb 28, 2013
deadalnix
Feb 28, 2013
Walter Bright
Feb 28, 2013
deadalnix
Feb 28, 2013
Walter Bright
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Walter Bright
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Ary Borenszweig
Feb 28, 2013
deadalnix
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
FG
Feb 28, 2013
Jonathan M Davis
Feb 28, 2013
Walter Bright
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Walter Bright
Feb 28, 2013
timotheecour
Feb 28, 2013
Michel Fortin
Feb 28, 2013
timotheecour
Feb 28, 2013
Walter Bright
Feb 28, 2013
Walter Bright
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Walter Bright
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Walter Bright
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Walter Bright
Mar 01, 2013
Jacob Carlborg
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Walter Bright
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Timon Gehr
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Walter Bright
Mar 01, 2013
Dmitry Olshansky
Mar 01, 2013
Jacob Carlborg
Feb 28, 2013
John Colvin
Feb 28, 2013
Marco Leise
Feb 28, 2013
Walter Bright
Feb 28, 2013
Andrej Mitrovic
Feb 28, 2013
Walter Bright
Feb 28, 2013
Ary Borenszweig
Feb 28, 2013
Walter Bright
Feb 28, 2013
deadalnix
Feb 28, 2013
Walter Bright
Feb 28, 2013
Timon Gehr
Feb 28, 2013
Walter Bright
Mar 01, 2013
deadalnix
Mar 01, 2013
Jacob Carlborg
Feb 28, 2013
deadalnix
Feb 28, 2013
Jonathan M Davis
Feb 28, 2013
Walter Bright
Feb 28, 2013
Jonathan M Davis
Feb 28, 2013
Zach the Mystic
Feb 28, 2013
Walter Bright
Feb 28, 2013
Jonathan M Davis
Feb 28, 2013
Walter Bright
Feb 28, 2013
Jonathan M Davis
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Walter Bright
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Jonathan M Davis
Feb 28, 2013
Walter Bright
Mar 01, 2013
Jonathan M Davis
Mar 01, 2013
Walter Bright
Mar 01, 2013
deadalnix
Mar 01, 2013
Walter Bright
Mar 01, 2013
Walter Bright
Mar 01, 2013
deadalnix
Mar 01, 2013
deadalnix
Mar 01, 2013
deadalnix
Feb 28, 2013
monarch_dodra
Feb 28, 2013
Walter Bright
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Walter Bright
Feb 28, 2013
bearophile
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Walter Bright
Feb 28, 2013
Walter Bright
Feb 28, 2013
Walter Bright
Feb 28, 2013
Dmitry Olshansky
Feb 28, 2013
Dmitry Olshansky
Mar 01, 2013
Simen Kjærås
Feb 28, 2013
Brian Schott
Feb 28, 2013
Peter Alexander
Feb 28, 2013
Walter Bright
Feb 28, 2013
deadalnix
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
monarch_dodra
Feb 28, 2013
Walter Bright
Feb 28, 2013
Walter Bright
Feb 28, 2013
Walter Bright
Feb 28, 2013
Walter Bright
Mar 24, 2013
deadalnix
Mar 24, 2013
deadalnix
Mar 24, 2013
John Colvin
Mar 24, 2013
John Colvin
Mar 24, 2013
deadalnix
Mar 24, 2013
bearophile
Feb 28, 2013
deadalnix
Feb 28, 2013
Walter Bright
Feb 28, 2013
Timon Gehr
Feb 28, 2013
jerro
Mar 01, 2013
Walter Bright
Mar 01, 2013
H. S. Teoh
Mar 01, 2013
Walter Bright
Feb 28, 2013
Walter Bright
Feb 28, 2013
Peter Alexander
Feb 28, 2013
Walter Bright
Feb 28, 2013
Artur Skawina
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Artur Skawina
Feb 28, 2013
Jacob Carlborg
Feb 28, 2013
Artur Skawina
Feb 28, 2013
Walter Bright
Feb 28, 2013
FG
Mar 01, 2013
Jonathan M Davis
Mar 01, 2013
Marco Leise
February 28, 2013
A SentinelInputRange is an InputRange with the following additions:

1. a compile time property 'sentinel' that is the terminating value of the range
2. empty is defined as: empty = (front == sentinel)
3. it is not necessary for empty to be called before front

A C style 0-terminated string is an example of a SentinelInputRange.

The additions to std.range would be:

1. isSentinelInputRange(T) which returns true if T is a SentinelInputRange
2. a unittest
3. documentation of this

An addition to std.string would be a function that takes a char* and returns a SentinelInputRange.

Motivation:
1. easy conversion of C strings to ranges
2. necessary for a fast implementation of a lexer

Any takers?
February 28, 2013
On 02/28/2013 02:11 AM, Walter Bright wrote:
> A SentinelInputRange is an InputRange with the following additions:
>
> 1. a compile time property 'sentinel' that is the terminating value of
> the range
> 2. empty is defined as: empty = (front == sentinel)
> 3. it is not necessary for empty to be called before front
>
> A C style 0-terminated string is an example of a SentinelInputRange.
>
> The additions to std.range would be:
>
> 1. isSentinelInputRange(T) which returns true if T is a SentinelInputRange
> 2. a unittest
> 3. documentation of this
>
> An addition to std.string would be a function that takes a char* and
> returns a SentinelInputRange.
>
> Motivation:
> 1. easy conversion of C strings to ranges
> 2. necessary for a fast implementation of a lexer
>
> Any takers?


This is not general enough. The concept is not exclusive to input ranges.
February 28, 2013
On Thursday, 28 February 2013 at 01:14:31 UTC, Timon Gehr wrote:
> On 02/28/2013 02:11 AM, Walter Bright wrote:
>> A SentinelInputRange is an InputRange with the following additions:
>>
>> 1. a compile time property 'sentinel' that is the terminating value of
>> the range
>> 2. empty is defined as: empty = (front == sentinel)
>> 3. it is not necessary for empty to be called before front
>>
>> A C style 0-terminated string is an example of a SentinelInputRange.
>>
>> The additions to std.range would be:
>>
>> 1. isSentinelInputRange(T) which returns true if T is a SentinelInputRange
>> 2. a unittest
>> 3. documentation of this
>>
>> An addition to std.string would be a function that takes a char* and
>> returns a SentinelInputRange.
>>
>> Motivation:
>> 1. easy conversion of C strings to ranges
>> 2. necessary for a fast implementation of a lexer
>>
>> Any takers?
>
>
> This is not general enough. The concept is not exclusive to input ranges.

I presume you're remembering that if something is a forward, bidirectional or random access range it is also an input range.

What further generality would you want?
February 28, 2013
On 02/28/2013 02:18 AM, John Colvin wrote:
> On Thursday, 28 February 2013 at 01:14:31 UTC, Timon Gehr wrote:
>> On 02/28/2013 02:11 AM, Walter Bright wrote:
>>> A SentinelInputRange is an InputRange with the following additions:
>>>
>>> 1. a compile time property 'sentinel' that is the terminating value of
>>> the range
>>> 2. empty is defined as: empty = (front == sentinel)
>>> 3. it is not necessary for empty to be called before front
>>>
>>> A C style 0-terminated string is an example of a SentinelInputRange.
>>>
>>> The additions to std.range would be:
>>>
>>> 1. isSentinelInputRange(T) which returns true if T is a
>>> SentinelInputRange
>>> 2. a unittest
>>> 3. documentation of this
>>>
>>> An addition to std.string would be a function that takes a char* and
>>> returns a SentinelInputRange.
>>>
>>> Motivation:
>>> 1. easy conversion of C strings to ranges
>>> 2. necessary for a fast implementation of a lexer
>>>
>>> Any takers?
>>
>>
>> This is not general enough. The concept is not exclusive to input ranges.
>
> I presume you're remembering that if something is a forward,
> bidirectional or random access range it is also an input range.
>
> What further generality would you want?

Never mind. I was confused.
February 28, 2013
On Thursday, 28 February 2013 at 01:12:19 UTC, Walter Bright wrote:
> A SentinelInputRange is an InputRange with the following additions:
>
> 1. a compile time property 'sentinel' that is the terminating value of the range
> 2. empty is defined as: empty = (front == sentinel)
> 3. it is not necessary for empty to be called before front
>
> A C style 0-terminated string is an example of a SentinelInputRange.
>
> The additions to std.range would be:
>
> 1. isSentinelInputRange(T) which returns true if T is a SentinelInputRange
> 2. a unittest
> 3. documentation of this
>
> An addition to std.string would be a function that takes a char* and returns a SentinelInputRange.
>
> Motivation:
> 1. easy conversion of C strings to ranges
> 2. necessary for a fast implementation of a lexer
>
> Any takers?

Seems smart. Patches up a hole in the armor of Ranges. What if more than one value can end the range, EOF, '\0'?
February 28, 2013
On 2/27/2013 5:53 PM, Zach the Mystic wrote:
> What if more than one
> value can end the range, EOF, '\0'?

I have never seen a need for that.
February 28, 2013
On Thursday, 28 February 2013 at 01:56:33 UTC, Walter Bright wrote:
> On 2/27/2013 5:53 PM, Zach the Mystic wrote:
>> What if more than one
>> value can end the range, EOF, '\0'?
>
> I have never seen a need for that.

Do you mean that you've never seen software that uses that, or that you've never been convinced that such software couldn't be made simpler?
February 28, 2013
On Thursday, 28 February 2013 at 01:56:33 UTC, Walter Bright wrote:
> On 2/27/2013 5:53 PM, Zach the Mystic wrote:
>> What if more than one
>> value can end the range, EOF, '\0'?
>
> I have never seen a need for that.

how about a predicate isSentinel instead of a fixed sentinel value?
That'd allow more flexibility such as more than one sentinel value.
February 28, 2013
On 2013-02-28 02:05:20 +0000, "timotheecour" <thelastmammoth@gmail.com> said:

> On Thursday, 28 February 2013 at 01:56:33 UTC, Walter Bright wrote:
>> On 2/27/2013 5:53 PM, Zach the Mystic wrote:
>>> What if more than one
>>> value can end the range, EOF, '\0'?
>> 
>> I have never seen a need for that.
> 
> how about a predicate isSentinel instead of a fixed sentinel value?
> That'd allow more flexibility such as more than one sentinel value.

Not usable in a switch/case statement.

-- 
Michel Fortin
michel.fortin@michelf.ca
http://michelf.ca/

February 28, 2013
>> how about a predicate isSentinel instead of a fixed sentinel value?
>> That'd allow more flexibility such as more than one sentinel value.
>
> Not usable in a switch/case statement.

why is that needed?
« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11