Tech Off Thread

28 posts

Features you like added to vb.net, c# or any other .net language.

Back to Forum: Tech Off
  • User profile image
    sysrpl

    Virtual constructors.

    // public virtual SampleObject(string name)  {  }

     

    Virtual static methods.

    // public static virtual DoSomething() { }

     

    Virtual static constructors.

     // public static virtual SampleObject(string name)  {  }

     

    Enumeration set operations.

    // textBox.Anchors += { AnchorStyles.Right, AnchorStyles.Bottom };

     

    Implementation through delegation.

    // public class SomeItems : IList<SomeItem> { private List<SomeItem> items; private implements IList<SomeItem> GetList() { return items; }  }

     

    Static method extensions.

    // public static void DoSomething(this SomeType, string message);

     

    Property extensions.

    // public string FunnyName { this SomeType; get; set; }

     

    Static property extensions.

    // public static string FunnyName { this SomeType; get; set; }

     

    Type aliases.

    // public typedef SomeItemList = List<SomeItem>;

     

    Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);

     

    Class references.

    // public SomeItemClass = class of SomeItem;

     

    Message based dynamic methods.

    // public message(1) void DoSomething(ref MessageArgs messageArgs) { }

    instance.
  • User profile image
    Sven Groot

    sysrpl said:

    Virtual constructors.

    // public virtual SampleObject(string name)  {  }

     

    Virtual static methods.

    // public static virtual DoSomething() { }

     

    Virtual static constructors.

     // public static virtual SampleObject(string name)  {  }

     

    Enumeration set operations.

    // textBox.Anchors += { AnchorStyles.Right, AnchorStyles.Bottom };

     

    Implementation through delegation.

    // public class SomeItems : IList<SomeItem> { private List<SomeItem> items; private implements IList<SomeItem> GetList() { return items; }  }

     

    Static method extensions.

    // public static void DoSomething(this SomeType, string message);

     

    Property extensions.

    // public string FunnyName { this SomeType; get; set; }

     

    Static property extensions.

    // public static string FunnyName { this SomeType; get; set; }

     

    Type aliases.

    // public typedef SomeItemList = List<SomeItem>;

     

    Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);

     

    Class references.

    // public SomeItemClass = class of SomeItem;

     

    Message based dynamic methods.

    // public message(1) void DoSomething(ref MessageArgs messageArgs) { }

    instance.

    Virtual constructors.

    // public virtual SampleObject(string name)  {  }

    What would that even do? You must invoke a constructor with an explicit type name (new Foo()), how would a virtual constructor even work? There's no vtable you can use yet. This is pointless.

     

    Virtual static methods.

    // public static virtual DoSomething() { }

    Same problem. Static methods are always invoked with a type name, not an insance, so no vtable, so no way to figure out which overridden method to use. Also pointless.

     

    Virtual static constructors.

     // public static virtual SampleObject(string name)  {  }

    This one doesn't make any sense whatsoever, not from a technical point of view, and I don't see what kind of scenario they would enable even if it were possible, which it isn't.

     

    Enumeration set operations.

    // textBox.Anchors += { AnchorStyles.Right, AnchorStyles.Bottom }; 

    Is doing "textBox.Anchors |= AnchorStyles.Right | AnchorStyles.Bottom;", which has the same effect, really so much harder?

     

    Implementation through delegation.

    // public class SomeItems : IList<SomeItem> { private List<SomeItem> items; private implements IList<SomeItem> GetList() { return items; }  }

    Sounds intriguing. It's essentially aggregation, although you would need to have a way to at least provide some of the methods yourself, otherwise there's not much point in aggregating in the first place.

     

    Static method extensions.

    // public static void DoSomething(this SomeType, string message);

    Could be useful if only to provide context for some methods. However, the syntax you give here is identical to that of regular extension methods (which are static methods on the class that defines them), and the use of the word "this" is confusing since static methods have no this pointer.

     

    Property extensions.

    // public string FunnyName { this SomeType; get; set; }

    Agreed. Note they are technically supported in IL, there's just no syntax for them yet.

     

    Static property extensions.

    // public static string FunnyName { this SomeType; get; set; }

    Same argument as static extension methods: don't use the keyword this.

     

    Type aliases.

    // public typedef SomeItemList = List<SomeItem>;

    Could be useful, but can also be confusing.

     

    Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);

    How Javascript. Tongue Out

     

    Class references.

    // public SomeItemClass = class of SomeItem;

     

    Message based dynamic methods.

    // public message(1) void DoSomething(ref MessageArgs messageArgs) { }

    Not sure what you mean by these.
    EDIT: The C9 editor screwed up all the quotes. Yay...

  • User profile image
    W3bbo

    sysrpl said:

    Virtual constructors.

    // public virtual SampleObject(string name)  {  }

     

    Virtual static methods.

    // public static virtual DoSomething() { }

     

    Virtual static constructors.

     // public static virtual SampleObject(string name)  {  }

     

    Enumeration set operations.

    // textBox.Anchors += { AnchorStyles.Right, AnchorStyles.Bottom };

     

    Implementation through delegation.

    // public class SomeItems : IList<SomeItem> { private List<SomeItem> items; private implements IList<SomeItem> GetList() { return items; }  }

     

    Static method extensions.

    // public static void DoSomething(this SomeType, string message);

     

    Property extensions.

    // public string FunnyName { this SomeType; get; set; }

     

    Static property extensions.

    // public static string FunnyName { this SomeType; get; set; }

     

    Type aliases.

    // public typedef SomeItemList = List<SomeItem>;

     

    Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);

     

    Class references.

    // public SomeItemClass = class of SomeItem;

     

    Message based dynamic methods.

    // public message(1) void DoSomething(ref MessageArgs messageArgs) { }

    instance.

    Type aliasing has been in C# since the beginning.

     

    using StringList = System.Collections.List<System.String>;

     

    the only problem with the syntax is that unless a type is specified with a keyword (string/int/etc) you must use the full type name, which gets tedious after a while. I'd prefer it if it respected existing namespace imports to resolve type names.

  • User profile image
    W3bbo

    sysrpl said:

    Virtual constructors.

    // public virtual SampleObject(string name)  {  }

     

    Virtual static methods.

    // public static virtual DoSomething() { }

     

    Virtual static constructors.

     // public static virtual SampleObject(string name)  {  }

     

    Enumeration set operations.

    // textBox.Anchors += { AnchorStyles.Right, AnchorStyles.Bottom };

     

    Implementation through delegation.

    // public class SomeItems : IList<SomeItem> { private List<SomeItem> items; private implements IList<SomeItem> GetList() { return items; }  }

     

    Static method extensions.

    // public static void DoSomething(this SomeType, string message);

     

    Property extensions.

    // public string FunnyName { this SomeType; get; set; }

     

    Static property extensions.

    // public static string FunnyName { this SomeType; get; set; }

     

    Type aliases.

    // public typedef SomeItemList = List<SomeItem>;

     

    Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);

     

    Class references.

    // public SomeItemClass = class of SomeItem;

     

    Message based dynamic methods.

    // public message(1) void DoSomething(ref MessageArgs messageArgs) { }

    instance.

    Type aliasing has been in C# since the beginning.

     

    using StringList = System.Collections.List<System.String>;

     

    the only problem with the syntax is that unless a type is specified with a keyword (string/int/etc) you must use the full type name, which gets tedious after a while. I'd prefer it if it respected existing namespace imports to resolve type names.

  • User profile image
    ktr

    sysrpl said:

    Virtual constructors.

    // public virtual SampleObject(string name)  {  }

     

    Virtual static methods.

    // public static virtual DoSomething() { }

     

    Virtual static constructors.

     // public static virtual SampleObject(string name)  {  }

     

    Enumeration set operations.

    // textBox.Anchors += { AnchorStyles.Right, AnchorStyles.Bottom };

     

    Implementation through delegation.

    // public class SomeItems : IList<SomeItem> { private List<SomeItem> items; private implements IList<SomeItem> GetList() { return items; }  }

     

    Static method extensions.

    // public static void DoSomething(this SomeType, string message);

     

    Property extensions.

    // public string FunnyName { this SomeType; get; set; }

     

    Static property extensions.

    // public static string FunnyName { this SomeType; get; set; }

     

    Type aliases.

    // public typedef SomeItemList = List<SomeItem>;

     

    Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);

     

    Class references.

    // public SomeItemClass = class of SomeItem;

     

    Message based dynamic methods.

    // public message(1) void DoSomething(ref MessageArgs messageArgs) { }

    instance.

    @sysrpl

    "Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);"

     

    I don't know... Perhaps only in a dynamic context?

     

    dynamic instance = GetInstance();
    instance.SomeNewProperty = 12;
    instance.SomeNewMethod = (string message) => MessageBox.Show(message);

  • User profile image
    Adam​Speight2008

    The ability to blend the different .net languages in a the same sourcecode, through the use of a new # tag.

    Just like vb.net has XML Literals.

     

    #Language="vb.net"
    Public Module Module1
    
     Sub Main()
    Dim n1 As Double=2
    Dim n2 As Double=3
    Dim result = Addition(n1,n2)
     Console.WriteLine(result)
     Console.ReadKey()
     End Sub
    #EndLanguage
     
    #Language="c#"
     public  double Addition(double x, double y) {
     return x + y;
    }
    #EndLanguage
    

    The c# is probably wrong (not my best) but you get the gist.

    Developers coding in prefered language.

     

    I don't think it be that hard to implement, all the required mechnisms are already built; the compilers. It may need a new linker.

     

  • User profile image
    spivonious

    AdamSpeight2008 said:

    The ability to blend the different .net languages in a the same sourcecode, through the use of a new # tag.

    Just like vb.net has XML Literals.

     

    #Language="vb.net"
    Public Module Module1
    
     Sub Main()
    Dim n1 As Double=2
    Dim n2 As Double=3
    Dim result = Addition(n1,n2)
     Console.WriteLine(result)
     Console.ReadKey()
     End Sub
    #EndLanguage
     
    #Language="c#"
     public  double Addition(double x, double y) {
     return x + y;
    }
    #EndLanguage
    

    The c# is probably wrong (not my best) but you get the gist.

    Developers coding in prefered language.

     

    I don't think it be that hard to implement, all the required mechnisms are already built; the compilers. It may need a new linker.

     

    Blending languages would be nice, although I'd be happy with files being in one language but projects being in multiple. So if I find a neat class on the web that's in C# but I want to use it in my VB project, and I don't want two DLLs, I don't need to translate the C# to VB (and inevitably introduce errors).

  • User profile image
    W3bbo

    spivonious said:
    AdamSpeight2008 said:
    *snip*

    Blending languages would be nice, although I'd be happy with files being in one language but projects being in multiple. So if I find a neat class on the web that's in C# but I want to use it in my VB project, and I don't want two DLLs, I don't need to translate the C# to VB (and inevitably introduce errors).

    Just integrate ILMerge into your build process.

     

    But is translating from VB to C# and back really that hard? Given most samples I see online (like on CodeProject) are in C# I think it'd be better to use C# anyway. The only VB samples I see are for trivial things because the people who consume them are beginners who are still finding their feet.

  • User profile image
    Adam​Speight2008

    W3bbo said:
    spivonious said:
    *snip*

    Just integrate ILMerge into your build process.

     

    But is translating from VB to C# and back really that hard? Given most samples I see online (like on CodeProject) are in C# I think it'd be better to use C# anyway. The only VB samples I see are for trivial things because the people who consume them are beginners who are still finding their feet.

    It would allow the coder to be more productive, since you eliminate the translation process.

  • User profile image
    W3bbo

    AdamSpeight2008 said:
    W3bbo said:
    *snip*

    It would allow the coder to be more productive, since you eliminate the translation process.

    I disagree there. When I translate code I'm forced to read it and see how it works, which is a good thing: it means I understand what my code is doing rather than doing "copy and paste programming".

  • Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.