Jump to page: 1 2 3
Thread overview
Examples Wanted: Usages of "body" as a Symbol Name
Oct 05, 2016
Meta
Oct 05, 2016
ketmar
Oct 05, 2016
Sönke Ludwig
Oct 05, 2016
Jacob Carlborg
Oct 05, 2016
Andrej Mitrovic
Oct 05, 2016
rcorre
Oct 05, 2016
angel
Oct 05, 2016
Rory McGuire
Oct 05, 2016
Matthias Klumpp
Oct 05, 2016
default0
Oct 05, 2016
Jonathan Marler
Oct 05, 2016
Jacob Carlborg
Oct 05, 2016
Jonathan Marler
Oct 05, 2016
Basile B.
Oct 05, 2016
Jonathan Marler
Oct 05, 2016
pineapple
Oct 05, 2016
Basile B.
Oct 06, 2016
Patrick Schluter
Oct 06, 2016
Jonathan M Davis
Oct 06, 2016
pineapple
Oct 07, 2016
Nick Treleaven
Oct 07, 2016
Jonathan M Davis
Oct 05, 2016
Basile B.
Oct 05, 2016
Meta
Oct 06, 2016
Jonathan M Davis
Oct 06, 2016
Luís Marques
Oct 16, 2016
Chris Wright
October 05, 2016
I'm currently writing up a DIP to propose removing `body` as a keyword to allow it to be used for variable names, functions, etc. I'm looking for examples and contexts where `body` would normally be used as a variable, function name, alias, etc. This is what I have come up with off the top of my head:

- In web programming where "body" is a required tag in any valid HTML document. Ex:
- It is a name commonly used for XML tags and/or attributes
- Physics simulations as well in astronomical contexts ("planetary bodyies", etc.)
- Video games, such as referring to the player character's body
October 05, 2016
On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
> I'm currently writing up a DIP to propose removing `body` as a keyword to allow it to be used for variable names, functions, etc. I'm looking for examples and contexts where `body` would normally be used as a variable, function name, alias, etc. This is what I have come up with off the top of my head:
>
> - In web programming where "body" is a required tag in any valid HTML document. Ex:
> - It is a name commonly used for XML tags and/or attributes
> - Physics simulations as well in astronomical contexts ("planetary bodyies", etc.)
> - Video games, such as referring to the player character's body

i think you covered most of the cases. as for me, it is more than enough. as for my cases, physics engines suffers most: it is *so* natural to use "body" field/variable there... and so annoying to always add ugly "_" suffix.
October 05, 2016
Am 05.10.2016 um 05:04 schrieb ketmar:
> On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
>> I'm currently writing up a DIP to propose removing `body` as a keyword
>> to allow it to be used for variable names, functions, etc. I'm looking
>> for examples and contexts where `body` would normally be used as a
>> variable, function name, alias, etc. This is what I have come up with
>> off the top of my head:
>>
>> - In web programming where "body" is a required tag in any valid HTML
>> document. Ex:
>> - It is a name commonly used for XML tags and/or attributes
>> - Physics simulations as well in astronomical contexts ("planetary
>> bodyies", etc.)
>> - Video games, such as referring to the player character's body
>
> i think you covered most of the cases. as for me, it is more than
> enough. as for my cases, physics engines suffers most: it is *so*
> natural to use "body" field/variable there... and so annoying to always
> add ugly "_" suffix.

+1 to physics, but I also hit it frequently when writing compilers/parsers (function, loop bodies etc.) and other programming language related libraries (scripting interfaces/wrappers).
October 05, 2016
On 2016-10-05 04:11, Meta wrote:

> - In web programming where "body" is a required tag in any valid HTML
> document. Ex:
> - It is a name commonly used for XML tags and/or attributes
> - Physics simulations as well in astronomical contexts ("planetary
> bodyies", etc.)
> - Video games, such as referring to the player character's body

- D compiler implementing the "body" keyword ;)

-- 
/Jacob Carlborg
October 05, 2016
On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
> I'm currently writing up a DIP to propose removing `body` as a keyword to allow it to be used for variable names, functions, etc. I'm looking for examples and contexts where `body` would normally be used as a variable, function name, alias, etc. This is what I have come up with off the top of my head:
>
> - In web programming where "body" is a required tag in any valid HTML document. Ex:
> - It is a name commonly used for XML tags and/or attributes
> - Physics simulations as well in astronomical contexts ("planetary bodyies", etc.)
> - Video games, such as referring to the player character's body

Physics libraries absolutely.

https://github.com/d-gamedev-team/dchip/blob/55f43e5f0cf67c8bc190711b69eb16230fa6188e/src/dchip/cpBody.d#L184
https://github.com/d-gamedev-team/dbox/blob/6f81fe065abec1e7def44fc777c5d8e9da936104/examples/demo/tests/bodytypes.d#L103

And in various C / C++ libraries. It's rather annoying that body is taken, it's a fairly rarely used keyword in D but often used in other languages.
October 05, 2016
On Wednesday, 5 October 2016 at 12:02:21 UTC, Andrej Mitrovic wrote:
> On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
>> [...]
>
> Physics libraries absolutely.
>
> https://github.com/d-gamedev-team/dchip/blob/55f43e5f0cf67c8bc190711b69eb16230fa6188e/src/dchip/cpBody.d#L184
> https://github.com/d-gamedev-team/dbox/blob/6f81fe065abec1e7def44fc777c5d8e9da936104/examples/demo/tests/bodytypes.d#L103
>
> And in various C / C++ libraries. It's rather annoying that body is taken, it's a fairly rarely used keyword in D but often used in other languages.

I created D bindings for chipmunk (unlike dchip which reimplemented it in D) and I had to change a _lot_ of bodies:

https://github.com/rcorre/chipmunkd/commit/d6bde5b649c70a53f4295f522e660fae3c1e740f

October 05, 2016
On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
> I'm currently writing up a DIP to propose removing `body` as a keyword to allow it to be used for variable names, functions, etc. I'm looking for examples and contexts where `body` would normally be used as a variable, function name, alias, etc. This is what I have come up with off the top of my head:
>
> - In web programming where "body" is a required tag in any valid HTML document. Ex:
> - It is a name commonly used for XML tags and/or attributes
> - Physics simulations as well in astronomical contexts ("planetary bodyies", etc.)
> - Video games, such as referring to the player character's body


Really, why do we need a _body_ ?
We have pre-condition and post-condition (in and out), everything else is a body.
It is simply inconsistent - a regular function with no in and out blocks has no body block. Now one adds a pre-condition (and / or post-condition) - whoop - one needs to wrap the whole function body ... well in a body expression.
October 05, 2016
On Wed, Oct 5, 2016 at 5:32 PM, angel via Digitalmars-d < digitalmars-d@puremagic.com> wrote:

> On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
>
>> I'm currently writing up a DIP to propose removing `body` as a keyword to allow it to be used for variable names, functions, etc. I'm looking for examples and contexts where `body` would normally be used as a variable, function name, alias, etc. This is what I have come up with off the top of my head:
>>
>> - In web programming where "body" is a required tag in any valid HTML
>> document. Ex:
>> - It is a name commonly used for XML tags and/or attributes
>> - Physics simulations as well in astronomical contexts ("planetary
>> bodyies", etc.)
>> - Video games, such as referring to the player character's body
>>
>
>
> Really, why do we need a _body_ ?
> We have pre-condition and post-condition (in and out), everything else is
> a body.
> It is simply inconsistent - a regular function with no in and out blocks
> has no body block. Now one adds a pre-condition (and / or post-condition) -
> whoop - one needs to wrap the whole function body ... well in a body
> expression.
>


Recently I've had to use scope_ a lot more often than body_ but reserved keywords are really annoying, so the less we have the better :D


October 05, 2016
On Wednesday, 5 October 2016 at 16:57:42 UTC, Rory McGuire wrote:
> On Wed, Oct 5, 2016 at 5:32 PM, angel via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>
>> On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
>> [...]
>> Really, why do we need a _body_ ?
>> We have pre-condition and post-condition (in and out), everything else is
>> a body.
>> It is simply inconsistent - a regular function with no in and out blocks
>> has no body block. Now one adds a pre-condition (and / or post-condition) -
>> whoop - one needs to wrap the whole function body ... well in a body
>> expression.
>>
>
> Recently I've had to use scope_ a lot more often than body_ but reserved keywords are really annoying, so the less we have the better :D

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?
October 05, 2016
On Wednesday, 5 October 2016 at 17:14:04 UTC, Matthias Klumpp wrote:
> On Wednesday, 5 October 2016 at 16:57:42 UTC, Rory McGuire wrote:
>> On Wed, Oct 5, 2016 at 5:32 PM, angel via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>>
>>> On Wednesday, 5 October 2016 at 02:11:14 UTC, Meta wrote:
>>> [...]
>>> Really, why do we need a _body_ ?
>>> We have pre-condition and post-condition (in and out), everything else is
>>> a body.
>>> It is simply inconsistent - a regular function with no in and out blocks
>>> has no body block. Now one adds a pre-condition (and / or post-condition) -
>>> whoop - one needs to wrap the whole function body ... well in a body
>>> expression.
>>>
>>
>> Recently I've had to use scope_ a lot more often than body_ but reserved keywords are really annoying, so the less we have the better :D
>
> 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?

To answer the question: if you can make them contextual keywords instead of keywords, then yes. Naturally that will increase complexity for correct syntax highlighting and similar things one may want to do to D code.
« First   ‹ Prev
1 2 3