Hi
I often end up forgetting a period. printOn: aStream super printOn: aStream. aStream nextPutAll: ' "' aStream nextPutAll: contents. aStream nextPutAll: '" '. And statically the system could see it with a simple heuristics: if the message as the same name as self, super, a tmp or an argument May be there is a missing period. Could the compiler get this analysis? Stef |
wouldn’t this be better to solve this with QA?
> On 3 Nov 2016, at 15:17, stepharo <[hidden email]> wrote: > > Hi > > I often end up forgetting a period. > > printOn: aStream > super printOn: aStream. > aStream nextPutAll: ' "' > aStream nextPutAll: contents. > aStream nextPutAll: '" '. > > > And statically the system could see it with a simple heuristics: > > if the message as the same name as self, super, a tmp or an argument > > May be there is a missing period. > > Could the compiler get this analysis? > > Stef > > |
In reply to this post by stepharo
2016-11-03 15:17 GMT+01:00 stepharo <[hidden email]>: Hi The highlighter gives some hints ( as in this example, message nextPutAll:nextPutAll: isn't known). And we have the RBUncommonMessageSendRule, but this rule only checks for messagenames like "self" or "true". It does not check the variables or argument names. |
In reply to this post by EstebanLM
Le 3/11/16 à 15:52, Esteban Lorenzano a écrit : > wouldn’t this be better to solve this with QA? but QA needs the analysis first. > >> On 3 Nov 2016, at 15:17, stepharo <[hidden email]> wrote: >> >> Hi >> >> I often end up forgetting a period. >> >> printOn: aStream >> super printOn: aStream. >> aStream nextPutAll: ' "' >> aStream nextPutAll: contents. >> aStream nextPutAll: '" '. >> >> >> And statically the system could see it with a simple heuristics: >> >> if the message as the same name as self, super, a tmp or an argument >> >> May be there is a missing period. >> >> Could the compiler get this analysis? >> >> Stef >> >> > > |
In reply to this post by stepharo
There is already RBUncommonMessageSendRule which checks for #(#self #super #thisContext #true #false #nil). I could also extend it to temps and args.
Uko > On 3 Nov 2016, at 15:17, stepharo <[hidden email]> wrote: > > Hi > > I often end up forgetting a period. > > printOn: aStream > super printOn: aStream. > aStream nextPutAll: ' "' > aStream nextPutAll: contents. > aStream nextPutAll: '" '. > > > And statically the system could see it with a simple heuristics: > > if the message as the same name as self, super, a tmp or an argument > > May be there is a missing period. > > Could the compiler get this analysis? > > Stef > > |
2016-11-03 21:53 GMT+01:00 Yuriy Tymchuk <[hidden email]>: There is already RBUncommonMessageSendRule which checks for #(#self #super #thisContext #true #false #nil). I could also extend it to temps and args. Hi Uko, I often write things like | abs | abs := self abs. so I would not like the temp/args rule... What make it obvious to our eyes is indentation in this case. From compiler POV it's just a yet unimplemented message. Can we have rules about indentation?
|
Yes, we can. I think that even easier heuristic would be to check if a unary is separated from the receiver by a line break.
|
2016-11-03 23:39 GMT+01:00 Yuriy Tymchuk <[hidden email]>:
+1, I guess such formatting is pretty unusual indeed... |
In reply to this post by Nicolas Cellier
2016-11-03 22:05 GMT+01:00 Nicolas Cellier <[hidden email]>:
But for args it could be not bad |
In reply to this post by stepharo
I'm always applying the autoformatting before I save the method, which helps me a lot in detecting those problems, because I immediately see that the code is formatted strangely.
But of course analysis would be nice for people that don't use autoformatting, or for better (and automated) detection. Peter On Thu, Nov 03, 2016 at 05:47:51PM +0100, stepharo wrote: > > > Le 3/11/16 à 15:52, Esteban Lorenzano a écrit : > >wouldn’t this be better to solve this with QA? > but QA needs the analysis first. > > > >>On 3 Nov 2016, at 15:17, stepharo <[hidden email]> wrote: > >> > >>Hi > >> > >>I often end up forgetting a period. > >> > >>printOn: aStream > >> super printOn: aStream. > >> aStream nextPutAll: ' "' > >> aStream nextPutAll: contents. > >> aStream nextPutAll: '" '. > >> > >> > >>And statically the system could see it with a simple heuristics: > >> > >> if the message as the same name as self, super, a tmp or an argument > >> > >>May be there is a missing period. > >> > >>Could the compiler get this analysis? > >> > >>Stef > >> > >> > > > > > > |
Free forum by Nabble | Edit this page |