About some issues in the latest FMX :) Sorry.

About some issues in the latest FMX :) Sorry.
http://sourceoddity.com/blog/2015/11/fixinsight-vs-fmx-in-delphi-10-seattle/

Comments

  1. This really points out the value of FixInsight!

    ReplyDelete
  2. Roman Yankovsky Good work. It saddens me that bugs don't get fixed even after they have been pointed out. I wish Emba were more committed to quality.

    Now an aside. What would you do about a loop like this?

    for i := 1 to 10 do
    List.Add(Random());

    Would that result in W528? And if so, is it possible to suppress locally?

    ReplyDelete
  3. David Heffernan the answer is "Yes" on both questions :)

    Yes, that would result in W528. And yes, you can suppress it locally using a special comment.

    For instance, this will not result in W528:
    for i := 1 to 10 do //FI:W528
    List.Add(Random());

    ReplyDelete
  4. Roman Yankovsky Thanks. I ask because this issue cropped up on SO with a user getting the same warning from Peganza.

    It got me thinking about the nature of loops. And a thread here yesterday got me thinking more about it. Eric made a good point about ordering. A for loop implies an ordering. In the simple loop I presented above, ordering is not irrelevant. But the simplest language feature we have for unordered repetition is the for loop, which is ordered.

    Anyway, looks like FI has this one covered.

    ReplyDelete
  5. FixInsight could ignore this when the loop variable is called _

    See http://stackoverflow.com/questions/3685974/python-iterate-a-certain-number-of-times-without-storing-the-iteration-number-a

    P.S. I am not completely serious. Personally I would not call this loop variable _

    ReplyDelete
  6. Roman Yankovsky I love these blogs - want more!!  :-D

    ReplyDelete
  7. David Heffernan The correct way would be to use an enumerator returning random numbers and then use for..in with Take (rng, 10) or equivalent.

    ReplyDelete
  8. Stefan Glienke My suggestion would generate 10 random numbers without the unnecessary loop counter, which is what David asked for in his follow-up no?

    ReplyDelete
  9. It was also slightly tongue-in-cheek by claiming it to be "the correct" way.

    ReplyDelete
  10. There is no better solution than to just not use the loop variable performance wise. Of course we can come up with all fancy ideas that involve creating iterators and passing anonymous methods and that but at the end of the day we just had an effing variable that was not used inside the loop which only FixInsight complained about ;)

    FWIW it should be possible to just omit the variable in the loop and write - that would be the cleanest solution I can think of (similar to scala where the syntax (x to y) represents a range):
    for 1 to 10 do ...

    oh and while improving that syntax also add the step size to the loop so I can write for 1 to 100 step 3 do ;)

    ReplyDelete
  11. How about running it on the rtl & vcl. I ran it on the rtl, found a couple of issues that looked like bugs. Couldn't find any dpk's for the vcl and FI needs a project to run.. would be good to be able to just point it at a folder.

    ReplyDelete
  12. Vincent Parrett  If you follow the links from the article you can see that Roman already did just that.

    ReplyDelete
  13. David Heffernan I have no idea what Vincent Parrett is running but it could be that Vincent would like to see if anything has been fixed since the initial test, compared to update #1... ?

    ReplyDelete
  14. Vincent Parrett Couldn't you mock up a dummy dpk/dpr for the units you want checked?

    ReplyDelete
  15. If only Embarcadero ... err... Idera checked the whole RAD Studio codebase with FixInsight!

    ReplyDelete
  16. Ilya S Come on... give Idera a break. They have only just got their new toy and still playing with it to see what it can do.

    I am more than happy to pass the blame to Idera but I won't do that until after the next release at the earliest.

    ReplyDelete
  17. Nicholas Ring I could just create my own dpk's, but I have better things to do! David Heffernan  thx, didn't see the links, read the post on my phone pre-coffee and without glasses!

    ReplyDelete

Post a Comment