A stupid English language question: new line or newline?

It is OT but...

Are the words "newline" and "filename" considered as single words?

When I name a function, I never know if I should write

AddNewLine in the sense Add + [a] + New + Line
or
AddNewline in the sense Add + [a] + Newline

Same problem with

GetFileName or GetFilename.

I "googled" and didn't find any satisfying answer.

Thanks in advance.
Jean-Michel Fauth, Switzerland.

Not sure on the rest of the world, but the Python and wxPython docs seem to refer tho both as single words. I'd never really thought too hard about it before, but a quick check of my own code shows 194 uses of "filename" and 3 uses of "file name" (and those only in comments).

Tim

jmf wrote:

···

It is OT but...

Are the words "newline" and "filename" considered as single words?

Technically speaking, nither newline nor filename are english words. In
the context of programming (at least that I can remember), "newline" is
seen more often than "new line", as is "filename" instead of "file name".

Ultimately it is a style question, so I would do whatever I find is
better style.

- Josiah

···

jmf <jfauth@bluewin.ch> wrote:

It is OT but...

Are the words "newline" and "filename" considered as single words?

jmf wrote:

When I name a function, I never know if I should write

AddNewLine in the sense Add + [a] + New + Line
or
AddNewline in the sense Add + [a] + Newline

I think newline is a word, at least in computer jargon, but it means "\n", rather than a new line added to a file or something. As in:

def AddNewline(string): # add a newline character to a string
     return string+"\n"

def AddNewLine(file, line):# write a new line to a file.
     file.write(AddNewline(line))

English doesn't technically allow one to just make new words by stringing existing words together (I think German does, at least Volkswagon indicates that: was "Fahrvergnügen" a word before they coined it?). However, new words are coined that way, and eventually become "official", and before that they can certainly be accepted jargon.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:
...

I think newline is a word, at least in computer jargon, but it means
"\n", rather than a new line added to a file or something. As in:

while I am not a native english speaker myself,
I was just about to post the same thing.
So this is my opinion, too.

However, the same thing does not apply to filename,
does it?

def AddNewline(string): # add a newline character to a string
    return string+"\n"

Correct.

def AddNewLine(file, line):# write a new line to a file.
    file.write(AddNewline(line))

This should be

def AddNewline(file, line):# write a new line to a file.
    file.write(AddNewline(line))

English doesn't technically allow one to just make new words by
stringing existing words together (I think German does, at least
Volkswagon indicates that: was "Fahrvergnügen" a word before they coined
it?). However, new words are coined that way, and eventually become
"official", and before that they can certainly be accepted jargon.

Very true.
It is also a common mistake among us (the native german
speakers) to do the same thing in english.
AFAIK, safetybelt, housedoor, etc. are not english words.
So I would use "newline", etc. with caution.

Carsten.