Examples Wanted: Usages of "body" as a Symbol Name

Basile B. via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 5 12:45:20 PDT 2016


On Wednesday, 5 October 2016 at 19:30:27 UTC, pineapple wrote:
> On Wednesday, 5 October 2016 at 19:02:02 UTC, Basile B. wrote:
>> On Wednesday, 5 October 2016 at 18:41:02 UTC, Jacob Carlborg 
>> wrote:
>>> On 2016-10-05 19:14, Matthias Klumpp wrote:
>>>
>>>> Agreed - I have exactly the same problem with "version", 
>>>> which is also
>>>> really common for, well, to hold a version number of a 
>>>> component. Body
>>>> is annoying too.
>>>>
>>>> But, can keywords actually sanely be removed from the 
>>>> language without
>>>> breaking the world?
>>>
>>> In Ruby most keywords are not reserved words. a.`def`()
>>
>> D context free grammar allow fast highlighting. I understand 
>> that people who write scripts think that it won't change 
>> anything...but it's not the reality. D is a system programming 
>> language, people who use D can deal with code base > 60 Kloc. 
>> And we don't want to see such a change because you can't use 
>> "body" in your student project.
>
> In general I don't think this is a problem, but `body` is an 
> unconventional term to have as a keyword. The other keywords 
> that are used for function contracts (`in` and `out`) are also 
> used in other places - perhaps `body` could be deprecated and 
> eventually removed in favor of using another keyword instead? 
> Either another, different keyword that is less likely to 
> collide with common attributes of user types, or an existing 
> keyword not meaningful in the same context.
>
> There may also be a case for making `body` implicit - e.g.
>
>     void func() in{
>         //
>     }out{
>         //
>     }body{
>         //
>     }
>
> Would become
>
>     void func() in{
>         //
>     }out{
>         //
>     }{
>         //
>     }
>
> I don't think this is of critical importance, but dealing with 
> this somehow would definitely be a step in the right direction.

Sorry Sophie, but do you really think that's consistent to have

in{}
out{}
{}

so the actual body without keyword ?
In this case let's drop completely the contracts...you can put 
them in the body, at the beg or at the end...The syntax will be 
less sane but the 4 guys who need "body" as identifier will be 
happy...


More information about the Digitalmars-d mailing list