September 17, 2021, 05:19:10

Author Topic: death to case sensitivity !  (Read 8361 times)

Offline meems

  • Sr. Member
  • ****
  • Posts: 310
Re: death to case sensitivity !
« Reply #45 on: June 06, 2018, 23:56:05 »
@Matty
>shows me that zome of the thoughts expressed never make it to industry
> implying that if syntaxbombers have a good idea, we can get it into industry languages in under 6 weeks

Sadly, you think too highly of us. If you are expecting us to get our better ideas into Java 10 and C# 7.4 then you're going to be disappointed. I'm flattered , hey, I know I'm ace, and I don't need anyone to tell me, but its best you understand I'm not the CEO or lead dev at Oracle or Microsoft.

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2440
Re: death to case sensitivity !
« Reply #46 on: June 07, 2018, 07:46:25 »
Me... I like to instantly see what the code is telling me. so I use the following:
methods/functions = CamelCase
local variables = lowerCase
class variables _lowerCase
constants = UPPER_CASE

other variables name exist - you then have to hunt for were they are set. if not local then check the private then protected then public areas. After that... phone home and ask for help ;)


Offline Derron

  • Hero Member
  • *****
  • Posts: 3651
Re: death to case sensitivity !
« Reply #47 on: June 07, 2018, 08:42:11 »
@ adam
you prefix all class variables with "_" underscore? I would have assumed people use it to define them as "private properties" (if the language does not offer a "private/public" portion in classes/types).

Else I use exactly the same (ok, had a time with "set***()" and "get***()" being written lowerCamelCase too ... dunno why)


bye
Ron

Offline Xaron

  • Sr. Member
  • ****
  • Posts: 353
Re: death to case sensitivity !
« Reply #48 on: June 07, 2018, 09:16:31 »
Here at work we use _variableName for all class members as well. That way you instantly see what's a member and what's not. It's in our coding guideline (plus tabs to spaces as well! :) ) Oh, we use C++ here. What a beast!

Offline col

  • Hero Member
  • *****
  • Posts: 590
Re: death to case sensitivity !
« Reply #49 on: June 07, 2018, 09:44:38 »
Quote
Here at work we use _variableName for all class members as well.
Quote
Oh, we use C++ here

I'm sure you're waiting for this already so I'll bite :)
In the C++ coding standard it states
Quote
"Don't overlegislate naming, but do use a consistent naming convention: There are only two must-dos: a) never use "underhanded names," ones that begin with an underscore or that contain a double underscore;"
(p2 , C++ Coding Standards, Herb Sutter and Andrei Alexandrescu).

I usually use the underscore style in BMax for private variables, but in C++ I generally use m_ for member variables and g_ for globals.


Offline Xaron

  • Sr. Member
  • ****
  • Posts: 353
Re: death to case sensitivity !
« Reply #50 on: June 07, 2018, 09:51:25 »
Haha good one and I tend to agree. But... I can't do anything about it here.

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 3224
  • elgol
Re: death to case sensitivity !
« Reply #51 on: June 07, 2018, 10:46:59 »
Quote
Me... I like to instantly see what the code is telling me. so I use the following:

methods/functions = CamelCase

Don't Mark's languages precede methods/functions with either the word method or function?  So that tells you what it is lol.  I guess you're talking about *calling* a method/function.  Even then is a distinction really necessary as methods/functions are followed by brackets which indicates a method/function, rather than a variable name?

Quote
local variables = lowerCase

class variables _lowerCase

What is the difference here Adam?  Class variables are member variables and a class should be a self contained unit, with data passed-in if appropriate.

And yes, col's correct when using C++ - do not use underscores to precede a variable's name.

 

Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry pi 3, pi 4, pi 400, BBC B, C64, ZX Spectrum

Offline Derron

  • Hero Member
  • *****
  • Posts: 3651
Re: death to case sensitivity !
« Reply #52 on: June 07, 2018, 10:52:41 »
> Even then is a distinction really necessary as methods/functions are followed by brackets which indicates a method/function, rather than a variable name?


function MyVar:int()
return 10
end function

print myvar * 10

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 3224
  • elgol
Re: death to case sensitivity !
« Reply #53 on: June 07, 2018, 10:54:31 »
Fair point.   :)

But shouldn't it be print MyVar() * 10
« Last Edit: June 07, 2018, 10:56:35 by Steve Elliott »
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry pi 3, pi 4, pi 400, BBC B, C64, ZX Spectrum

Offline Derron

  • Hero Member
  • *****
  • Posts: 3651
Re: death to case sensitivity !
« Reply #54 on: June 07, 2018, 11:10:51 »
it should - but it isn't needed (at least in BlitzMax) - at least not in call cases.

above's example btw fails:
Compile Error: Types 'Int(Int)' and 'Int' are unrelated

bye
Ron

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 3224
  • elgol
Re: death to case sensitivity !
« Reply #55 on: June 07, 2018, 11:21:04 »
Then it's the language that is at fault, leading to people having to clarify using case sensitivity.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry pi 3, pi 4, pi 400, BBC B, C64, ZX Spectrum

Offline Matty

  • Hero Member
  • *****
  • Posts: 1369
    • MattiesGames
Re: death to case sensitivity !
« Reply #56 on: June 07, 2018, 12:32:12 »
Mine is simple.

Everything in lowercase except constants which are all caps.
I eat cheese in the trees when its eight degrees

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2440
Re: death to case sensitivity !
« Reply #57 on: June 07, 2018, 13:59:40 »
@Steve
With monkey you have properties - that are sort of like variables but can also do lots of other stuff too.
e.g.
Code: [Select]
Class Channel
Method New()
End

Property Stereo:bool()
Return _stereo
Setter( stereo:bool )
_stereo = stereo
End

private
field _stereo:bool = False
End Class

Local myChannel =  New Channel
myChannel.Stereo = true
Print myChannel.Stereo

_stereo is private and we cant access it
but with setters and properies we can both set and see what it is - we can also add other code in these too...

But <WARNING> You must watch the cases and what variables you are dealing with in the properties and setters. otherwise it will all go Pete Tong!

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 3224
  • elgol
Re: death to case sensitivity !
« Reply #58 on: June 07, 2018, 14:20:19 »
Quote
But <WARNING> You must watch the cases and what variables you are dealing with in the properties and setters. otherwise it will all go Pete Tong!

So it's Mark's Monkey Madness then lol.   :P
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry pi 3, pi 4, pi 400, BBC B, C64, ZX Spectrum

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2440
Re: death to case sensitivity !
« Reply #59 on: June 07, 2018, 14:47:49 »
yep. wait a minute.... thinks and looks at really old blitzmax code
Yep using _ as the first character is definitely a monkey2 Mark thing  :))

interesting to note that it is 'illegal' in c++ to do it (which is what monkey2 compiles into).

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal