|
pkfox has just replied and says it's me - but I'm happy for you or me to do it.
Do you want it? Say the word and it's yours!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You won, you do it tomorrow. I'll compete again
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Sorry griff see my apology - you are up tomorrow
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
getEnum.Statements.Add(
new CodeMethodReturnStatement(
new CodeObjectCreateExpression(
"TableTokenizerEnumerator",
new CodeMethodInvokeExpression(
new CodeMethodReferenceExpression(
new CodeFieldReferenceExpression(
new CodeThisReferenceExpression(),
innerField.Name),
"GetEnumerator")),
new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), dfaTableField.Name),
new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), blockEndsField.Name),
new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), nodeFlagsField.Name))));
All that, to make this:
return new TableTokenizerEnumerator(this._inner.GetEnumerator(), this._dfaTable, this._blockEnds, this._nodeFlags);
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I don't always use Expression Trees, but when I do it's a big, long, unreadable Christmas tree
I usually try to first declare all kinds of Expressions in variables and then use those, but it's usually a lost cause.
|
|
|
|
|
at one point I went as far as creating a limited programming language that resolved to code dom constructs instead of code. i called it slang and it could emit VB, C# or whatever. Unfortunately it was proprietary as part of a company's IP i worked for at the time or I'd be using it now.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I only need them when working with some generic EF code.
Only once did I need it to output code and that was for an article
|
|
|
|
|
Code generation is sort of specialized, but I've always written code to write code.
My father was a toolmaker - he used to make machines that stamped sheetmetal for parts for large trucks and stuff. Weird job, but I think I've got it in my blood, as I prefer to make tools for other people to make stuff with, and that involves codegen a lot. =)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
LOL
You're gonna hate me, but none of my generated code ever has Finalize() methods unless it's only C# and not the codedom.
but lately all my generation code has used the codedom, just so I can support VB
to be honest i don't even know VB syntax.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: You're gonna hate me, but none of my generated code ever has Finalize() methods Why would I hate you for that?
I've never written a finalizer in my life... Or thinking back on it, once, maybe.
honey the codewitch wrote: to be honest i don't even know VB syntax. To tell you an uglier truth, I do
|
|
|
|
|
I know VB6 and VBScript pretty well as a matter of necessity in the bad old days of microsoft land when every idiot fine programmer out there was using it to write bad software. It was usually my job to try and fix it, which really meant gleaning the functional requirements from undocumented source code and then rewriting.
Since .NET i've seen little of it, and I've had no use for VB.NET.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Sander Rossel wrote: To tell you an uglier truth, I do
And what's the problem with that?
Are you becoming a snob as well?
|
|
|
|
|
Jörgen Andersson wrote: And what's the problem with that? You wouldn't be asking me this is you saw the VB code I had to work with
I used to love VB.NET, even after I started doing C#.
But after years of doing C# I now have to use it again and it's just lagging behind in pretty much everything.
The fact that Option Strict is off by default (causing much of my current problems) makes it bad by default.
Sub and Function As Object (or worse, just Function without an As clause because that's optional without Option Strict) feels weird.
The default indentation in Visual Studio sucks.
If something AndAlso
somethingElse Then
DoSomething()
ThisIsAlsoAFunction
End If Keywords like End Function , AndAlso and OrElse are unnecessarily long.
Don't even get me started on lambda's! collection.Where(Function(x) x.Something) vs. collection.Where(x => x.Something) !
Meanwhile, shortcuts like inline ref variables don't make it to VB.
Because it's not case sensitive myVar and MyVar are the same, meaning I sometimes need to think just a bit harder to name my variables.
Static classes don't exist, you need a Module , but that's slightly different (in that functions become public without the need of using the class name) making a Private Class with Private Sub New() the closest to a static class.
And please don't use the default VB namespace Modules that are imported by default!
If I'm honest, I've never seen good VB code that I didn't write myself, while I've seen some good C# code.
Microsoft is quickly dropping support for new platforms and VB.
It's only just been added to .NET Core with version 3, together with WinForms support.
Try finding (good) code samples for VB online.
Even newer Visual Studio functionality, like code cleanup, is not available for VB.
All in all, I have no reason whatsoever (or even a choice) to use VB in any modern software development.
Let me end with a small positive note for the language I started in.
One thing VB does right (in WinForms development) is Sub MyButton_Click(sender As Object, e As EventArgs) Handles MyButton.Click , which I find more clear than the C# way of adding a handler in the designer.
|
|
|
|
|
Sander Rossel wrote: The fact that Option Strict is off by default
Major f***up, agreed.
Sander Rossel wrote: The default indentation in Visual Studio sucks.
So, do you prefer Allman, K&R or Whitesmith?
Sander Rossel wrote: Keywords like End Function , AndAlso and OrElse are unnecessarily long.
Those aren't even very long.
Sander Rossel wrote: Because it's not case sensitive myVar and MyVar are the same Here I have to really disagree with you, having two variables like myVar and MyVar isn't just against MS naming convention, it's also honestly quite stupid. I've seen more than one bug coming from this.
Sander Rossel wrote: If I'm honest, I've never seen good VB code that I didn't write myself There are two ways I can take that, and in either case I believe I have to take offence.
Sander Rossel wrote: Microsoft is quickly dropping support for new platforms and VB.
Try finding (good) code samples for VB online. Agreed, this is also the reason that I've been using mostly C# for quite a few years
Most of the rest you bring up is just general whining.
You're becoming an old git. How does it feel to be so young and already being older than me?
Soon enough you're going to change your name to OriginalRosemary, f*** no, OriginalRossel, no, still wrong. SROP, yeah, that's it!
|
|
|
|
|
Jörgen Andersson wrote: So, do you prefer Allman, K&R or Whitesmith? I didn't even know this existed!
It seems all but Allman are pretty messed up
Jörgen Andersson wrote: having two variables like myVar and MyVar isn't just against MS naming convention, it's also honestly quite stupid Property MyProp with backing field myProp, MS uses it too
The _myProp style was disbanded by MS in VS2010 I think, at least in C#.
It's really not that weird.
In C# I never need backing fields because all my properties are auto-properties.
Of course, in VB, support for auto-properties is limited so I still need them from time to time
Jörgen Andersson wrote: There are two ways I can take that, and in either case I believe I have to take offence. I guess you should take it as "Sander hasn't seen my code"
Jörgen Andersson wrote: Most of the rest you bring up is just general whining. I can live with the verbosity, but when you ask me what's wrong with VB I'm going all out
The incomplete tooling compared to C# is something I blame on MS.
Jörgen Andersson wrote: You're becoming an old git. How does it feel to be so young and already being older than me? You young folk get off my back, you hear!
Jörgen Andersson wrote: SROP, yeah, that's it! That made me laugh, but... Not in a million years
|
|
|
|
|
Sander Rossel wrote: It seems all but Allman are pretty messed up
And there you parted with OG. He's diehard Whitesmith.
Sander Rossel wrote: Property MyProp with backing field myProp, MS uses it too
And they use m_MyProp and _MyProp as well. I didn't say they live according to their own rules.
Sander Rossel wrote: The _myProp style was disbanded by MS in VS2010 I think, at least in C#.
I think it was still around 2013, those rules change every few years anyway.
Current rules states no prefixes and no underscores at all, but they also state that fields should be Pascal cased, and that naming should avoid confusion. And at least the last part makes proper sense no matter what. Especially since the same name with different case also tends to confuse intellisense.
Sander Rossel wrote: in VB, support for auto-properties is limited
Is it? Works fine for me since long.
And another comment on your previous post: You shouldn't blame the tool for the tools using it.
If VB goes out of fashion they will just start using a different language.
It seems at the moment that C# isn't it, but rather Javascript and Python. Or whatever is taught in the schools at the moment.
|
|
|
|
|
Jörgen Andersson wrote: And there you parted with OG. He's diehard Whitesmith. I don't want to hang around such psychopaths anyway
Seriously though, you'd have to change all the Visual Studio defaults and anyone working with your code after that will curse you for doing so
Jörgen Andersson wrote: but they also state that fields should be Pascal cased Fields Pascal? Where did you find that? I always camelCase them and never seen different.
Intellisense works fine for same name variables that are differently cased, at least in C#
I don't think I do it a lot though, but I wanted to do it in VB because of the auto-property issue I mentioned.
I also use it when, for example, I have a property MyResult and then in a method I calculate myResult in a local variable.
Jörgen Andersson wrote: Is it? Works fine for me since long. Try to set Public ReadOnly Property MyProperty As String (there's that verboseness again).
I figured it out, you have to set the invisible field _MyProperty
Jörgen Andersson wrote: You shouldn't blame the tool for the tools using it. I'm not sure what you mean, but I never blamed tools.
I blame VB programmers for writing abysmal code
|
|
|
|
|
Sander Rossel wrote: and anyone working with your code after that will curse you for doing so
I wouldn't curse you, only turn passive aggressive and think you're stupid.
Sander Rossel wrote: Fields Pascal? Where did you find that? Names of Type Members | Microsoft Docs[^]
Note though something I didn't notice yesterday: design-guidelines wrote: The field-naming guidelines apply to static public and protected fields. Internal and private fields are not covered by guidelines But guess how the private invisible backing variable to the autoimplemented property looks like. Also in C#.
So even if they removed that guideline some years ago, the compiler still does it.
|
|
|
|
|
Sander Rossel wrote: One thing VB does right (in WinForms development) is Sub MyButton_Click(sender As Object, e As EventArgs) Handles MyButton.Click , which I find more clear than the C# way of adding a handler in the designer.
Just don't look at the generated code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's the point.
If I want to remove a handler in VB I just remove the handler and be done with it.
In C# I have to visit two places and if I remove just the addhandler I'm left with some handler that's never triggered!
|
|
|
|
|
no typedef!
dt = new KeyValuePair<KeyValuePair<CharFA<TAccept>, CharFA<TAccept>>, RegexExpression>(
new KeyValuePair<CharFA<TAccept>, CharFA<TAccept>>(
dt.Key.Key,
dt.Key.Value),
tt[dt.Key]);
I want to make the C# language team have to declare things like this all day long.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
using KV = KeyValuePair<CharFA<TAccept>, CharFA<TAccept>>;
|
|
|
|
|
Doesn't work. Using requires hard types. It can't use the type parameter TAccept
FOr it to be able to do that it would have to work like C++ where typedef kinda runs like a preprocessor macro (as do source templates)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Mmm... Like Harold said, compiles for me!
using System;
using ListI = System.Collections.Generic.List<int>;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var f = new ListI();
f.Add(1);
Console.WriteLine(f.Count);
}
}
}
|
|
|
|
|