Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9227)

Issue 561640043: Abstract Grob property storage into Mutable_properties.

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years ago by hanwenn
Modified:
4 years ago
Reviewers:
hahnjo, Dan Eble, dan, lemzwerg, dak
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

Abstract Grob property storage into Mutable_properties. No functional changes. This change makes it easier to reorganize the storage for mutable properties.

Patch Set 1 #

Total comments: 9

Patch Set 2 : dan #

Unified diffs Side-by-side diffs Delta from patch set Stats (+237 lines, -88 lines) Patch
M lily/break-substitution.cc View 1 5 chunks +19 lines, -19 lines 0 comments Download
M lily/grob.cc View 1 8 chunks +12 lines, -15 lines 0 comments Download
M lily/grob-property.cc View 11 chunks +30 lines, -33 lines 0 comments Download
M lily/grob-scheme.cc View 1 chunk +0 lines, -12 lines 0 comments Download
M lily/grob-smob.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M lily/include/grob.hh View 3 chunks +6 lines, -5 lines 0 comments Download
A lily/include/mutable-properties.hh View 1 1 chunk +75 lines, -0 lines 0 comments Download
A lily/mutable-properties.cc View 1 1 chunk +91 lines, -0 lines 0 comments Download

Messages

Total messages: 17
hahnjo
https://codereview.appspot.com/561640043/diff/565900043/lily/grob-scheme.cc File lily/grob-scheme.cc (left): https://codereview.appspot.com/561640043/diff/565900043/lily/grob-scheme.cc#oldcode326 lily/grob-scheme.cc:326: This should very probably not be part of this ...
4 years ago (2020-04-13 14:56:45 UTC) #1
lemzwerg
From visual inspection, LGTM. I only wonder whether we should use if { foo(...); } ...
4 years ago (2020-04-13 14:58:01 UTC) #2
hanwenn
On 2020/04/13 14:58:01, lemzwerg wrote: > From visual inspection, LGTM. > > I only wonder ...
4 years ago (2020-04-13 15:04:38 UTC) #3
hanwenn
https://codereview.appspot.com/561640043/diff/565900043/lily/grob-scheme.cc File lily/grob-scheme.cc (left): https://codereview.appspot.com/561640043/diff/565900043/lily/grob-scheme.cc#oldcode326 lily/grob-scheme.cc:326: On 2020/04/13 14:56:45, hahnjo wrote: > This should very ...
4 years ago (2020-04-13 15:06:16 UTC) #4
hahnjo
On 2020/04/13 15:06:16, hanwenn wrote: > https://codereview.appspot.com/561640043/diff/565900043/lily/grob-scheme.cc > File lily/grob-scheme.cc (left): > > https://codereview.appspot.com/561640043/diff/565900043/lily/grob-scheme.cc#oldcode326 > ...
4 years ago (2020-04-13 16:03:00 UTC) #5
hanwenn
On 2020/04/13 16:03:00, hahnjo wrote: > On 2020/04/13 15:06:16, hanwenn wrote: > > https://codereview.appspot.com/561640043/diff/565900043/lily/grob-scheme.cc > ...
4 years ago (2020-04-13 16:09:14 UTC) #6
Dan Eble
https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh File lily/include/mutable-properties.hh (right): https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode31 lily/include/mutable-properties.hh:31: class Iterator { This is useful, but instead of ...
4 years ago (2020-04-13 17:15:19 UTC) #7
hanwenn
https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh File lily/include/mutable-properties.hh (right): https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode31 lily/include/mutable-properties.hh:31: class Iterator { On 2020/04/13 17:15:19, Dan Eble wrote: ...
4 years ago (2020-04-13 17:22:52 UTC) #8
Dan Eble
On 2020/04/13 17:22:52, hanwenn wrote: > > If you're not interested in doing this, I ...
4 years ago (2020-04-13 17:28:16 UTC) #9
hahnjo
On 2020/04/13 17:28:16, Dan Eble wrote: > On 2020/04/13 17:22:52, hanwenn wrote: > > > ...
4 years ago (2020-04-13 17:30:46 UTC) #10
dak
https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh File lily/include/mutable-properties.hh (right): https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode31 lily/include/mutable-properties.hh:31: class Iterator { On 2020/04/13 17:22:52, hanwenn wrote: > ...
4 years ago (2020-04-13 20:10:35 UTC) #11
hanwenn
On 2020/04/13 20:10:35, dak wrote: > https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh > File lily/include/mutable-properties.hh (right): > > https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode31 > ...
4 years ago (2020-04-13 20:27:34 UTC) #12
hanwenn
dan
4 years ago (2020-04-13 20:29:26 UTC) #13
hanwenn
https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh File lily/include/mutable-properties.hh (right): https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode54 lily/include/mutable-properties.hh:54: Iterator iter() const { On 2020/04/13 17:15:19, Dan Eble ...
4 years ago (2020-04-13 20:31:05 UTC) #14
dak
On 2020/04/13 20:27:34, hanwenn wrote: > On 2020/04/13 20:10:35, dak wrote: > > > https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh ...
4 years ago (2020-04-13 20:33:49 UTC) #15
dan_faithful.be
On Apr 13, 2020, at 16:31, hanwenn@gmail.com wrote: > >> Does const serve a purpose ...
4 years ago (2020-04-13 22:10:25 UTC) #16
hanwenn
4 years ago (2020-04-17 19:17:01 UTC) #17
On 2020/04/13 22:10:25, dan_faithful.be wrote:
> On Apr 13, 2020, at 16:31, mailto:hanwenn@gmail.com wrote:
> > 
> >> Does const serve a purpose here?  The iterator doesn't carry through
> > with any
> >> kind of enforcement.  The same question applies to try_retrieve() and
> >> to_alist().
> > 
> > It allows one to iterate over properties in a const method.
> > 
> > What kind of enforcement are you looking for?
> 
> There's a tension between C++ and Scheme structures that I struggle with.  In
> C++, a const method usually doesn't change the externally observable state of
> its object, and *usually* avoids returning a non-const reference to a
component
> part, so as not to open a way for the caller to mutate the object.
> 
> If this const method is not enforcing these things because SCM data structures
> have no constness, then what is the value in declaring it const?  You've said
> that you're declaring it const so that it can be called from a const method.
> Granting that the caller may be const for a good reason, the suggestion that a
> Mutable_properties object will not be changed by a caller that calls
> properties.to_alist() is misleading.
> 
> I think it would be better to declare methods as const where it agrees with
> reality, e.g. contains().  That way you can meaningfully pass a const
Whatever&
> around and trust that the recipient can not change its state.  I would do this
> even if the consequence is that passing a const Whatever& is not useful at
> present.
> 
> In the case that concerns you--iterating the SCM list in a const method of a
> class that owns a Mutable_properties object—I think I would declare the
> Mutable_properties object as mutable.  That way, all the owner's methods can
do
> as they please with the owned Mutable_properties, consistent with its nature
as
> primarily a SCM structure.
> 
> In short, that way "const" means const, and "mutable" means mutable.

I view const more as a structured comment than an enforcing mechanism. If we
would 
take a strict stance, I think we would have to delete most of the const
keywords,
and that would actually increase the chances of developers misusing the APIs.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b