Announcement

Collapse
No announcement yet.

Ubuntu Developers Discuss Using Mono AOT

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Umm, that's exactly what you do.

    using System.blah.foo.bar.xyzz;

    new something(); //where something is defined in namespace System.blah.foo.bar.xyzz

    is correct. If there is a conflict, such as 2 classes in different namespaces that have the same name, then you can even redefine one of them.

    using something2 = System.blah.foo.bar.xyzz.something;

    new something2();
    No, that's where it doesn't compile, because "using System.blah.foo.bar.xyzz;" is somehow not valid even when having one or two levels less is. I don't mean classes, but static methods and the like; they can never be used just by their name, it's always at least one level of unnecessary fuzz.

    For example (may be wrong, just for illustration), Math.PI always has to be typed like that, you can't "using Math" and then type "PI".

    I'm starting to think you just don't know how to program in C#, and are assuming a lot of things to be true that aren't.
    Yes, I have significantly more experience in C and C++ than C#. Because of that I expect C# not to have some of the blunders it has, given they were better in languages invented decades earlier.

    Comment


    • #17
      BTW, Control.FindControl seems to be a web function, would it have worked in WPF?

      http://msdn.microsoft.com/en-us/library/486wc64h.aspx

      Comment


      • #18
        Originally posted by curaga View Post
        No, that's where it doesn't compile, because "using System.blah.foo.bar.xyzz;" is somehow not valid even when having one or two levels less is. I don't mean classes, but static methods and the like; they can never be used just by their name, it's always at least one level of unnecessary fuzz.

        For example (may be wrong, just for illustration), Math.PI always has to be typed like that, you can't "using Math" and then type "PI".
        Oh, I see. Yes, the using statement only goes to the class level. If you want to access static or constant variable/functions inside a class, then you must preface it with the class name.

        Still, that's only 1 level - i have a hard time seeing how Math.PI is that much worse than PI. You shouldn't ever need to do some entire System.blah.foo.bar.Math.PI.

        Edit:
        Oh, maybe you are talking about things like Application.Current.MainWindow.

        That's simply chaining calls together.

        Application app = Application.Current; //calls a static method in the Application class
        app.MainWindow; //gets the object from the Application class

        It's a pretty common convention in C# i suppose. But it really has nothing to do with the using statement.
        Last edited by smitty3268; 05-12-2012, 05:19 PM.

        Comment


        • #19
          Originally posted by curaga View Post
          BTW, Control.FindControl seems to be a web function, would it have worked in WPF?

          http://msdn.microsoft.com/en-us/library/486wc64h.aspx
          Also in WinForms, but I confess to not being as familiar with WPF. It seems not - i did find this http://stackoverflow.com/questions/6...-find-controls which gives a little method to look controls up by their name.

          To be honest, I'm not in love with the direction WPF went, that does seem overly complicated, even if it is possible.

          Comment


          • #20
            Originally posted by smitty3268 View Post
            Still, that's only 1 level - i have a hard time seeing how Math.PI is that much worse than PI. You shouldn't ever need to do some entire System.blah.foo.bar.Math.PI.
            Instead of "Math", picture "OverlyLongClassNameJustBecauseWeLikeThem". You see why it's bad?

            Comment


            • #21
              Originally posted by curaga View Post
              Instead of "Math", picture "OverlyLongClassNameJustBecauseWeLikeThem". You see why it's bad?
              using M = MyCrazyNameSpace.With.Lots.OfHierarchy.OverlyLongC lassNameJustBecauseWeLikeThemWhichHasPiDefined;

              Console.WriteLine(M.PI);

              Edit:
              I don't see why long names are bad. Everyone I know that writes C, C++, C#, Java, Python, ... programs larger than "Hello World" is using an IDE with code completion. Long descriptive names help reading the code.

              Edit2:
              For the checkbox problem you mentioned you could have had it easy if you created a checkbox array in the first place in the form. And if you need unique checkbox identifier you could have used the "Tag" property to store an unique identifier (string). Finding a checkbox by name would have been an easy task: var myIdCheckbox = checkboxArray.Find(cb => "MyId" == (string)cb.Tag);
              Last edited by droste; 05-12-2012, 06:08 PM.

              Comment


              • #22
                Originally posted by uid313 View Post
                Someone should port the Java Class Library to C#.
                Someone already has: http://www.ikvm.net/

                Comment


                • #23
                  All this Mono vs. Java/C/whatever talk is irrelevant. It is fine for Ubuntu to offer Mono apps as an option, but they should not be in the default install, especially if Ubuntu continues to constrain itself to a CD-sized install .iso.

                  Comment


                  • #24
                    Originally posted by uid313 View Post
                    Mono is full open source under MIT, LGPL, GPL.

                    C# is a Ecma standard, ECMA-334.
                    None of this is the problem, it is the non-free .NET classes such as ASP.NET, ADO.NET and Winforms that are implemented in Mono that are the problem.

                    Get rid of Mono, nuke it from orbit, it is the only way to be sure.

                    Comment


                    • #25
                      Originally posted by droste View Post
                      using M = MyCrazyNameSpace.With.Lots.OfHierarchy.OverlyLongC lassNameJustBecauseWeLikeThemWhichHasPiDefined;

                      Console.WriteLine(M.PI);
                      That's the third overload of "using" in just this thread, none having anything to do with the others. Did I mention I find C#'s "using" illogical?

                      Edit:
                      I don't see why long names are bad. Everyone I know that writes C, C++, C#, Java, Python, ... programs larger than "Hello World" is using an IDE with code completion. Long descriptive names help reading the code.
                      Too long names hinder reading too. If just your hierarchy and class name takes a line entirely by itself, it's hardly an optimal reading experience.

                      Also, if you requre autocompletion (not to mention IDE!) to code, then your language and/or project is broken. It's an ugly misfeature working around a deficiency in design, mainly too long and ugly naming.

                      Edit2:
                      For the checkbox problem you mentioned you could have had it easy if you created a checkbox array in the first place in the form. And if you need unique checkbox identifier you could have used the "Tag" property to store an unique identifier (string). Finding a checkbox by name would have been an easy task: var myIdCheckbox = checkboxArray.Find(cb => "MyId" == (string)cb.Tag);
                      In my opinion that is still a kludge, just as much as the Dictionary. The checkboxes already had names, why should I be required to assign each 500 of them a new property.

                      Comment


                      • #26
                        Originally posted by curaga View Post
                        That's the third overload of "using" in just this thread, none having anything to do with the others. Did I mention I find C#'s "using" illogical?
                        Only your opinion...

                        Originally posted by curaga View Post
                        Too long names hinder reading too. If just your hierarchy and class name takes a line entirely by itself, it's hardly an optimal reading experience.
                        Nobody is using the full class name (with namespace hierarchy) inside the actual code. That is what using is for...

                        Originally posted by curaga View Post
                        Also, if you requre autocompletion (not to mention IDE!) to code, then your language and/or project is broken. It's an ugly misfeature working around a deficiency in design, mainly too long and ugly naming.
                        Nobody is forcing you to use an IDE. It is perfectly working without... I was just saying everybody _is_ using one.

                        Originally posted by curaga View Post
                        In my opinion that is still a kludge, just as much as the Dictionary. The checkboxes already had names, why should I be required to assign each 500 of them a new property.
                        Again, if you only needed say the 400th checkbox an array would be enough: checkboxArray[400-1];
                        Also if the name is unique enough for you don't need to set the Tag property. checkboxArray.Find(cb => "MyCb" == cb.Name); works too

                        So all in all you don't like C# out of not knowing how to handle things in C#. That's ok. You've done much c++ and like it. You know libraries and how to use the language. Fine. But that doesn't mean c++ is the holy grail of programming languages and C# is shit.

                        Comment


                        • #27
                          So all in all you don't like C# out of not knowing how to handle things in C#.
                          I disagree. I've been pointed out the "right way" by people more experienced in it such as yourself, and even the "right way" was not that good.

                          Comment


                          • #28
                            Originally posted by curaga View Post
                            I disagree. I've been pointed out the "right way" by people more experienced in it such as yourself, and even the "right way" was not that good.
                            Also your standard of "good". I find them very good.

                            Edit:
                            Except WinForms... there's really no good thing in WinForms ;-) but that has nothing to do with C#

                            Comment


                            • #29
                              Originally posted by uid313 View Post
                              As I understand it, C# is faster than Java, Python, Perl, Ruby, PHP, etc.
                              C# is lot easier and friendlier to code in than C, C++, Objective-C.
                              C# is a language. The following parody demonstrates the error in the poster's logic.

                              As I understand it, Spanish is faster than English, German, Russian, etc.
                              Spanish is a lot easier and friendlier to speak than Greek, Chinese, and Arabic.

                              People speak the language that they, and/or their audience, are most familiar with. For languages that use an IR/VM, the language is only as fast as the interpreter/translator.

                              F

                              Comment


                              • #30
                                Originally posted by curaga View Post
                                First of all, that's illogical by itself in a language that shouts loudly "no you don't need to mind memory with me".
                                Don't need to manage memory, yes. The same isn't true of other resources - e.g you can't open database connections at will and throw them away, relying on garbage collection to close them before the database server starts complaining.

                                Comment

                                Working...
                                X