many commands have been deprecated

  1. ‹ Older
  2. 8 weeks ago

    Geoff P

    May 16 Xojo Inc Austin, Texas

    @JohannKienbrandt to have more consistency is only true for 20% of the changes ...

    I'm not sure what you mean. Could you give an example?

  3. Michael H

    May 17 Testers, Xojo Pro Europe (Hamburg, Germany)
    Edited 8 weeks ago

    @Rick A If that was true, Xojo would make a code "translator". But as things potentially will break, like 1 based code needing refactoring for 0 based, they don't.

    Yes, switching from 1-based to 0-based isn’t a matter of search-and-replace but it’s worthwhile – making everything 0-based is the path to sanity in my view. Having said that there is no pressing need to make all the changes at once; you could start with the simple changes and turn to the more complex stuff at your leisure.

  4. Stuart L

    May 17 Tokyo, Japan

    I have only been using Xojo for a few weeks. Not sure if it is related API 1 or 2 but the inconsistency drives me crazy.

    Why is there Add for a collection, Addrow for an array and an item assignment for a Dictionary.
    In reverse there is remove for both collection and dictionary, but only a RemoveAt for an array.

    What is the point of this?

    Thanks

    stu

  5. Beatrix W

    May 17 Testers, Third Party Store Europe (Germany)

    Collection should have been removed 10 years ago. Don't use it.

    A dictionary doesn't have an order so the beyond silly AddRow doesn't make sense. The RemoveAt also doesn't make sense for a dictionary.

  6. @Geoff P — My main problem here is that there are hundreds of bugs waiting to be fixed for years and yet Xojo would rather give priority to changing method's names.

    If we want to change a RemoveAllRows method by DeleteAllRows, we can do it ourselves. What we cannot do ourselves is to make the compiler better and properly handling cases where it fails now.

    So please set your priorities right.

  7. Ulrich B

    May 17 Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    @Geoff P I'm not sure what you mean. Could you give an example?

    I would not agree with the 20 %, but String.Nthfield is an unlogic that already struck me a few times. Why is this still 1-based?

  8. Alberto D

    May 17 Testers, Xojo Pro Austin, Texas

    @Ulrich B I would not agree with the 20 %, but String.NthField is an unlogic that already struck me a few times. Why is this still 1-based?

    The problem with NthField is that there is no new API 2.0 method.

    This is what is being deprecated:

    result=NthField(source, separator, fieldNumber)

    The API 2.0 way to use NthField is being available since 5.0 (don't know if that is RealBasic or RealStudio).
    This from NthField doc:

    result=stringVariable.NthField(separator, fieldNumber) Introduced 5.0

    This from String.NthField doc (API 2.0 way):

    result=stringVariable.NthField(separator, fieldNumber)

    If I were in charge of the docs, I will remove the big red box here and change the deprecated syntax only to:

    result=NthField(source, separator, fieldNumber) // This syntax is deprecated, use the other syntax

    If someone can find a good name for the NthField replacement, maybe Xojo can create an API 2.0 version that is 0 based. It can't be NthField because that will break old code that use the String.NthField syntax.

    String.NthField2 to indicate is API 2.0 ? or String.NthField0 to indicate that is 0 based?

  9. Sam R

    May 17 Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    You can always create your own Nthfield. Hint: Use instrb

  10. Julia T

    May 17 Sandy Hook, Connecticut

    I never had any problems, from Day One of my use of RealBasic/Studio/Xojo, with the fact that string functions were all one-based, and everything else was zero-based. Just not an issue at all. Now it's become an issue, because I have to unlearn :(

  11. Karen A

    May 17 Testers

    @Julia T I never had any problems, from Day One of my use of RealBasic/Studio/Xojo, with the fact that string functions were all one-based, and everything else was zero-based.

    Some say that Files indexes in folders were 1 based... but that was not true.. originally the 0th item was the parent folder!

    The only place that they really messed up in API 1 IMO was in the database Recordset methods where RecordSet.ColumnType is 0 based while RecordSet.IdxField is 1 based... I do trip over that one a lot!

    -Karen

  12. Julia T

    May 17 Sandy Hook, Connecticut

    @Karen A RecordSet.IdxField is 1 based

    I'm not a database user, so never encountered that, but yeah, it sounds like that should definitely be zero-based.

  13. Emile S

    May 17 Europe (France, Strasbourg)

    Checking the LR for 0 or 1 based is far less than an annoyance (for me).

    But reaching how to replace http://docs.xojo.com/GetFolderItem is real challenge: it takes far more time.

  14. Stuart L

    May 17 Tokyo, Japan

    @Beatrix W Collection should have been removed 10 years ago. Don't use it.

    A dictionary doesn't have an order so the beyond silly AddRow doesn't make sense. The RemoveAt also doesn't make sense for a dictionary.

    Thank you for responding, I will not use collection any more.

    An Add method to go with the Remove method on the dictionary would be nice though. :)

  15. Stuart L

    May 17 Tokyo, Japan

    @Sam R You can always create your own Nthfield. Hint: Use instrb

    Instrb - "This item was deprecated in version 2019r2." :)

    Out of the frying pan into the fire?

  16. Tim P

    May 17 Testers, Xojo Pro Rochester, NY
    Edited 8 weeks ago

    @Stuart L An Add method to go with the Remove method on the dictionary would be nice though. :)

    Stick this on a global module in your project, because if it were in the framework it would make many things ten times more complicated than they need to be.

    Public Sub Add(extends toDict as Dictionary, vKey as Variant, assigns vValue as Variant)
      if toDict.HasKey(vKey) then
        dim ex as new UnsupportedOperationException
        ex.Message = "This key exists already, use the Value function."
        raise ex
        
      end
      
      toDict.Value(vKey) = vValue
    End Sub
  17. 7 weeks ago

    Stuart L

    May 17 Tokyo, Japan

    @Tim P Stick this on a global module in your project, because if it were in the framework it would make many things ten times more complicated than they need to be.
    Public Sub Add(extends toDict as Dictionary, vKey as Variant, assigns vValue as Variant) if toDict.HasKey(vKey) then dim ex as new UnsupportedOperationException ex.Message = "This key exists already, use the Value function." raise ex end toDict.Value(vKey) = vValue End Sub

    Thank you - this community is very helpful. :)

  18. Jeff T

    May 18 Midlands of England, Europe

    I'm scared to even start trying to update my code to suit API2

  19. Tim S

    May 18 Testers Canterbury, UK

    I finished mine some time ago. Then again, I've got the time to do it. From about 5000, now just two deprecation warnings left that will go when 2020r1 arrives.

    I've also gotten rid of Text, and all usage of Xojo.XXX. With the new DateTime class, out went my own DateTime subclass of Date to which I'd added SecondsSince1970.

    Yesterday I finally paid attention to the ability of Database.ExecuteSQL and .SelectSQL to accept parameters for Prepare, so out went three of my own methods which did more or less the same.

    I also rethought my socket handling and ended up writing my own method to validate UTF8 which was what allowed me to complete the removal of Text from my app. I think one has to do that sometimes - see Feedback Case #44953 for another example.

  20. David C

    May 18 Testers, Xojo Pro, XDC Speakers Derby, ITM

    @Jeff T I'm scared to even start trying to update my code to suit API2

    Make sure you have a back up and lots of time. The backup is good in case you make a change then forget what the code used to look like. Time is needed because I had 20,000+ deprecations, now down to nought for desktop apps. I have gone from 10,000 errors (forced deprecations) to 3,500 in my main Web 2.0 app. It has taken me a few weeks to convert both Desktop and Web.
    The result is my code is now MUCH cleaner and smaller, and works across Desktop and Web with little difference. I spend a lot of time removing duplicate Desktop/Web code these days.
    My muscle memory is harder to train since I still have some old API 1.0 code I need to maintain for a client. I will have to straddle the API 1.0/2.0 universes for a while.

  21. Tim S

    May 18 Testers Canterbury, UK

    My bottom line is that I'm feeling rather positive about API 2.

or Sign Up to reply!