C# vs. JavaScript/Typescript dyslexia
-
-
used to do this all the dang time. I don't write Javascript anymore unless I have too. hasn't happened in over a year! Yay me. But I switch between Powershell, SQL, C# etc... I sometimes forget how to comment in the language I am in at the time. It seems strange to me. I can write code quite well switching around. But I cannot remember how to comment in Powershell vs SQL vs C#. The Brain it is strange.
To err is human to really elephant it up you need a computer
-
rnbergren wrote:
I sometimes forget how to comment in the language I am
Most folks I know don't know how to comment in any language; or, if they do know how, they don't use that ability.
-
Do one language and do it well.
PIEBALDconsult wrote:
Do one language and do it well.
I can do both :) And both are continual "doing it better" experiences. That never ends, no matter how many years I've done development. Not only because of course the language features evolve.
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions -
Marc Clifton wrote:
JS: let s = Foo = `${foo}`;
Or, if you get the quotes in the right place:
let s = `Foo = ${foo}`;
:)
Marc Clifton wrote:
C#: braces are on separate lines JS: opening brace is on the same line.
Actually, in C#, braces can be on the same line, a different line, or whatever you call the abomination of a formatting style that @OriginalGriff prefers. :-D JS mostly doesn't care. It's only an issue with things like
return { ... };
, where putting the opening brace on a new line confuses the parser into thinking it's two statements with a missing semicolon afterreturn
.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Richard Deeming wrote:
Or, if you get the quotes in the right place:
Oops. :-\
Richard Deeming wrote:
Actually, in C#, braces can be on the same line, a different line,
Well yes, but ever since C++ I've used the separate line style.
Richard Deeming wrote:
JS mostly doesn't care. It's only an issue with things like
return { ... };
I believe
return ({...});
also helps that? I know in some cases I have to put the object {} in parens so as not to confuse JS.Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions -
used to do this all the dang time. I don't write Javascript anymore unless I have too. hasn't happened in over a year! Yay me. But I switch between Powershell, SQL, C# etc... I sometimes forget how to comment in the language I am in at the time. It seems strange to me. I can write code quite well switching around. But I cannot remember how to comment in Powershell vs SQL vs C#. The Brain it is strange.
To err is human to really elephant it up you need a computer
rnbergren wrote:
I sometimes forget how to comment in the language
Comments? What are those and when did that feature get introduced? ;)
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions -
C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions -
C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread SubscriptionsMarc Clifton wrote:
C# vs. JavaScript/Typescript dyslexia
I find this in general. A great number of modern languages use the C/C++-style syntax and so differences can get confusing. Java, Kotlin, Rust, D, etc. all suffer from/contribute to it.
-
C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread SubscriptionsMarc Clifton wrote:
Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Don't write both.
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread Subscriptions -
C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread SubscriptionsI sometimes still type 'Dim i as Long' in C. VB is the computer science equivalent to Saigon.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
There was a time when i could write Univac assembler code with only minimal reference to the OS reference manual. Modern languages are now so feature rich you need the SDK reference almost every few lines. Or maybe I am just not very good at it.
And there are new languages coming out every day!
Wear your mask! the life you save may be your own.
-
C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread SubscriptionsIt is a mental discipline of learning how to forget. I have only half way mastered it.
So many years of programming I have forgotten more languages than I know.
-
C#: var foo = "foo"; JS: let foo = "foo"; or: let foo = 'foo'; C#: var s = $"Foo = {foo}"; JS: let s = Foo = `${foo}`; C#: int Fnc(string a) TS: fnc(a: string): number C#: braces are on separate lines JS: opening brace is on the same line. C#: if (!String.IsNullOrEmpty(foo)) JS: if (foo) C#: Reverse(foo); JS: this.reverse(foo); or even worse: this.reverse(this.foo); Half the time I wrote the wrong syntax for the wrong language. :rolleyes:
Latest Articles:
Client-Side Type-Based Publisher/Subscriber, Exploring Synchronous, "Event-ed", and Worker Thread SubscriptionsYes! I've been going through exactly this all week.
cheers Chris Maunder