Hi Marcel,
I see the "name is shadowed" warning from methods such as CommunityTheme class>>#createDark "self createDark apply." | name | name := 'Community (dark)'. ^ (self named: name) in: [:theme | theme merge: (self named: 'Squeak') overwrite: true. theme name: name. "General morph stuff." theme ... and I thought to correct them but then thought that they don't need the name ten var at all, and hence realised they could be auto generated. Are they? Is it safe to edit them to rename name to e.g. themeName, or even to eliminate the temp var altogether? _,,,^..^,,,_ best, Eliot |
On Fri, 14 Oct 2016, Eliot Miranda wrote:
> Hi Marcel, > I see the "name is shadowed" warning from methods such as > > CommunityTheme class>>#createDark > "self createDark apply." > | name | > name := 'Community (dark)'. > ^ (self named: name) in: [:theme | > theme merge: (self named: 'Squeak') overwrite: true. > theme name: name. > "General morph stuff." > theme > ... > > and I thought to correct them but then thought that they don't need the name ten var at all, and hence realised they could be auto generated. Are > they? Is it safe to edit them to rename name to e.g. themeName, or even to eliminate the temp var altogether? variable would do it? Levente > > _,,,^..^,,,_ > best, Eliot > > |
I used to use #in: a lot so my methods could be one elegant
hierarchical expression. Then one day you changed one of my methods to do temporary assignment with comment that it creates a unncessary block activation which could slow down performance. That's when I stopped using #in:. I didn't realize there was a performance cost. On Sat, Oct 15, 2016 at 4:37 AM, Levente Uzonyi <[hidden email]> wrote: > On Fri, 14 Oct 2016, Eliot Miranda wrote: > >> Hi Marcel, >> I see the "name is shadowed" warning from methods such as >> >> CommunityTheme class>>#createDark >> "self createDark apply." >> | name | >> name := 'Community (dark)'. >> ^ (self named: name) in: [:theme | >> theme merge: (self named: 'Squeak') overwrite: true. >> theme name: name. >> "General morph stuff." >> theme >> ... >> >> and I thought to correct them but then thought that they don't need the >> name ten var at all, and hence realised they could be auto generated. Are >> they? Is it safe to edit them to rename name to e.g. themeName, or even >> to eliminate the temp var altogether? > > > Totally irrelevant, but what's the point of using #in: when a temporary > variable would do it? > > Levente > >> >> _,,,^..^,,,_ >> best, Eliot >> > > > |
On 15.10.2016, at 18:03, Chris Muller <[hidden email]> wrote: > I used to use #in: a lot so my methods could be one elegant > hierarchical expression. > > Then one day you changed one of my methods to do temporary assignment > with comment that it creates a unncessary block activation which could > slow down performance. > > That's when I stopped using #in:. I didn't realize there was a > performance cost. > Wouldn't it be great if there wasn't? Best regards -Tobias > > On Sat, Oct 15, 2016 at 4:37 AM, Levente Uzonyi <[hidden email]> wrote: >> On Fri, 14 Oct 2016, Eliot Miranda wrote: >> >>> Hi Marcel, >>> I see the "name is shadowed" warning from methods such as >>> >>> CommunityTheme class>>#createDark >>> "self createDark apply." >>> | name | >>> name := 'Community (dark)'. >>> ^ (self named: name) in: [:theme | >>> theme merge: (self named: 'Squeak') overwrite: true. >>> theme name: name. >>> "General morph stuff." >>> theme >>> ... >>> >>> and I thought to correct them but then thought that they don't need the >>> name ten var at all, and hence realised they could be auto generated. Are >>> they? Is it safe to edit them to rename name to e.g. themeName, or even >>> to eliminate the temp var altogether? >> >> >> Totally irrelevant, but what's the point of using #in: when a temporary >> variable would do it? >> >> Levente >> >>> >>> _,,,^..^,,,_ >>> best, Eliot >>> >> >> >> > |
On Sat, 15 Oct 2016, Tobias Pape wrote:
> > On 15.10.2016, at 18:03, Chris Muller <[hidden email]> wrote: > >> I used to use #in: a lot so my methods could be one elegant >> hierarchical expression. >> >> Then one day you changed one of my methods to do temporary assignment >> with comment that it creates a unncessary block activation which could >> slow down performance. >> >> That's when I stopped using #in:. I didn't realize there was a >> performance cost. >> > > Wouldn't it be great if there wasn't? It would be nice, but that's hardly possible. But my point was that #in: here just makes the code harder to read. I just checked my Trunk image, and I found that it's full of similar uses of #in:. There are very few places where a temporary variable wouldn't be feasable. Levente > Best regards > -Tobias > >> >> On Sat, Oct 15, 2016 at 4:37 AM, Levente Uzonyi <[hidden email]> wrote: >>> On Fri, 14 Oct 2016, Eliot Miranda wrote: >>> >>>> Hi Marcel, >>>> I see the "name is shadowed" warning from methods such as >>>> >>>> CommunityTheme class>>#createDark >>>> "self createDark apply." >>>> | name | >>>> name := 'Community (dark)'. >>>> ^ (self named: name) in: [:theme | >>>> theme merge: (self named: 'Squeak') overwrite: true. >>>> theme name: name. >>>> "General morph stuff." >>>> theme >>>> ... >>>> >>>> and I thought to correct them but then thought that they don't need the >>>> name ten var at all, and hence realised they could be auto generated. Are >>>> they? Is it safe to edit them to rename name to e.g. themeName, or even >>>> to eliminate the temp var altogether? >>> >>> >>> Totally irrelevant, but what's the point of using #in: when a temporary >>> variable would do it? >>> >>> Levente >>> >>>> >>>> _,,,^..^,,,_ >>>> best, Eliot >>>> >>> >>> >>> >> > > > |
Free forum by Nabble | Edit this page |