Skip to content

Comments

Qualify C-style memory allocation functions as pure#1510

Open
nordlow wants to merge 1 commit intodlang:masterfrom
nordlow:patch-3
Open

Qualify C-style memory allocation functions as pure#1510
nordlow wants to merge 1 commit intodlang:masterfrom
nordlow:patch-3

Conversation

@nordlow
Copy link
Contributor

@nordlow nordlow commented Nov 1, 2016

Update according to dlang/druntime#1683

I'm not sure if this is enough or if I should update the general formulation of purity aswell.

Made an existing statement more clear via a neither-nor formulation.

Update according to dlang/druntime#1683

I'm not sure if this is enough or if I should update the general formulation of purity aswell.

Made an existing statement more clear via a neither-nor formulation.
$(H4 $(LNAME2 pure-functions, Pure Functions))

$(P Pure functions are functions which cannot access global or static, mutable
$(P Pure functions are functions which cannot access neither global nor static mutable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add , back in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean I should undo this fix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No neither global nor static {,} mutable state

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work for it to be both cannot and neither. Either it's cannot with either and or, or it's can with neither and nor. You basically have a double negative if you have cannot with neither.

It was actually correct before, albeit a bit weird. It would probably flow better if mutable were put first, e.g.

cannot access mutable global or static state

or if you want to be really clear but somewhat awkward

cannot access mutable global or mutable static state

But as it stands, the fix is just wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants