Spaces in file names

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Spaces in file names

Post by thatkeith » Wed Jul 05, 2017 11:59 am

Bit of an odd one... a colleague who I consider to be normally technically highly astute is adamant that people shouldn't use spaces in file names, ever, and the justification was that "spaces use more memory". This is in the context of 'advice to students' along with lists of basic keyboard shortcuts, how to zip a folder, etc. To me, this is fundamentally flawed. Sure, there are specific situations where spaces in filename and paths *can* cause hiccups, but software creators should build safeguards against this kind of problem anyway. In UX terms this kind of 'cure' is far worse than the perceived problem – not to mention being inappropriate to bother media-industry students about this.

Anyway, apologies for venting... any reactions to the "spaces use more memory" comment? Ignore the fact that we're not working with early 1980s-level memory limits so it would be utterly irrelevant in any normal situation – is it even true?

k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Spaces in file names

Post by jmburnod » Wed Jul 05, 2017 12:14 pm

Hi thatkeith,
I believe that "memory argument" is not relevant and " any normal situation " should allows import files contents created by the users without garanties to respect this rule.
best regards
Jean-Marc
https://alternatic.ch

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Spaces in file names

Post by FourthWorld » Wed Jul 05, 2017 3:04 pm

An argument for leaner memory is (and certainly greater performance) might apply with case-sensitive file systems, but I can't think of any reason why a space character (or any other single-byte entity) would require more memory than any other character of the same size.

This may present an opportunity for the organization to review policies related to workplace drug and alcohol use. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Spaces in file names

Post by thatkeith » Wed Jul 05, 2017 3:07 pm

FourthWorld wrote:I can't think of any reason why a space character (or any other single-byte entity) would require more memory than any other character of the same size.
Mmm, quite. :D
FourthWorld wrote:This may present an opportunity for the organization to review policies related to workplace drug and alcohol use. :)
Heh. Well, considering there's a subsidised Student Union bar in the building... ;)
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Spaces in file names

Post by mwieder » Wed Jul 05, 2017 6:22 pm

This may present an opportunity for the organization to review policies related to workplace drug and alcohol use. :)
LOL

Well, look... if I put a space in a filename, that uses up more memory than not putting in a space, no? And if I put in ten spaces, that's an order of magnitude more memory than if I hadn't done that in the first place. And it uses more time to do all that typing as well, so it's a waste of both space *and* time. Pretty soon we'll be opening up wormholes to who knows where and the aliens will be able to come through and we'll have to put on those tinfoil hats for protection and you see where this is going all because of spaces in filenames?

On a different note, I do usually try not to use spaces in filenames because of the need to quote paths from a commandline. And that goes double for folder names. And yes, you do have to script things carefully when dealing with file paths because whether you use spaces or not, your users will do this all the time, and if you haven't coded properly for this things will break.

A long time ago Ken Ray posted a function that I use all the time for quoting. I don't think I have released a single app that doesn't incorporate it:

Code: Select all

function q pText
    return quote & pText & quote
end q

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spaces in file names

Post by bogs » Sun Feb 14, 2021 4:36 pm

I had obviously (somehow) missed this thread, even though it occurred after my join date (go figure) :shock:

However, since I didn't miss it when it was given a new post this time around, I thought what the heck :twisted:
thatkeith wrote:
Wed Jul 05, 2017 11:59 am
people shouldn't use spaces in file names, ever, and the justification was that "spaces use more memory".
Although not as important since, say, 1994 or so, this was indeed the norm before that when having +/- some huge KB of ram was a luxury.

By the way, I don't like spaces in filenames either, but it is not because of some throwback to an earlier time when a few bytes mattered :twisted:
FourthWorld wrote:
Wed Jul 05, 2017 3:04 pm
An argument for leaner memory is (and certainly greater performance) might apply with case-sensitive file systems, but I can't think of any reason why a space character (or any other single-byte entity) would require more memory than any other character of the same size.
His friend isn't suggesting substituting another character for a space the way I read it, he is talking about eliminating spaces altogether. Arguably,
tmFile.txt
would take less memory than
tm File.txt
if you see what I'm saying. Not by a huge amount, by any means, but still some amount depending on what your using to encode the character. For instance, consider this nice breakdown I found on Stack overflow -
An ASCII character in 8-bit ASCII encoding is 8 bits (1 byte), though it can fit in 7 bits.

An ISO-8895-1 character in ISO-8859-1 encoding is 8 bits (1 byte).

A Unicode character in UTF-8 encoding is between 8 bits (1 byte) and 32 bits (4 bytes).

A Unicode character in UTF-16 encoding is between 16 (2 bytes) and 32 bits (4 bytes), though most of the common characters take 16 bits. This is the encoding used by Windows internally.

A Unicode character in UTF-32 encoding is always 32 bits (4 bytes).

An ASCII character in UTF-8 is 8 bits (1 byte), and in UTF-16 - 16 bits.

The additional (non-ASCII) characters in ISO-8895-1 (0xA0-0xFF) would take 16 bits in UTF-8 and UTF-16.
Image

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Spaces in file names

Post by thatkeith » Sun Feb 14, 2021 5:09 pm

bogs wrote:
Sun Feb 14, 2021 4:36 pm
His friend isn't suggesting substituting another character for a space the way I read it, he is talking about eliminating spaces altogether. Arguably,
tmFile.txt
would take less memory than
tm File.txt
I should have added that their answer to my challenge was to advise underscores instead of spaces. Which entirely invalidated even a hint of logic in their argument. :D
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spaces in file names

Post by bogs » Sun Feb 14, 2021 5:21 pm

Well, I feel I was denied critical, most needful to know information !

Richard's interpretation was the more accurate one then. Bad on your friend :twisted:
Image

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Spaces in file names

Post by SparkOut » Sun Feb 14, 2021 8:09 pm

Of course SpectateSwamp is a spammer, but reawakened an curious thread. I mean... "my file name.txt" takes up more memory than "myfilename.txt" but "myfilename.txt" still takes up a lot more memory than "f.txt". Why not have a naming convention to shorten all names to the barest minumum length?
And what of the contents of the file? Chances are that would take vastly more memory usage than anything that a space or two in the filename could conceivably make a difference.
Now, spaces in filenames cause some issues in unquoted paths. But if that isn't featuring in the "logic" then I have to wonder... was this a delayed response to an original April Fool's prank?

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spaces in file names

Post by bogs » Sun Feb 14, 2021 8:19 pm

SparkOut wrote:
Sun Feb 14, 2021 8:09 pm
Why not have a naming convention to shorten all names to the barest minumum length?
Well, coming from before and through the 8.3 file naming format, I already *do* set up files with length in mind most of the time heh.
Image

Davidv
Posts: 77
Joined: Sun Apr 09, 2006 1:51 am
Location: Australia

Re: Spaces in file names

Post by Davidv » Sun Feb 14, 2021 9:53 pm

Ihavenoideawhatistheproblemwithbeingmoreefficientbyeliminatingspacesbeingjustnaturallywhatmanyprogrammerswouldthinktoimprovetheworld.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spaces in file names

Post by bogs » Sun Feb 14, 2021 10:01 pm

Davidv wrote:
Sun Feb 14, 2021 9:53 pm
Ihavenoideawhatistheproblemwithbeingmoreefficientbyeliminatingspacesbeingjustnaturallywhatmanyprogrammerswouldthinktoimprovetheworld.
I think you have forgotten a few caMels in your [case] :D

IHaveNoIdeaWhatIsTheProblemWithBeingMoreEfficientByEliminatingSpacesBeingJustNaturallyWhatManyProgrammersWouldThinkToImproveTheWorld.text
Image

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Spaces in file names

Post by SparkOut » Sun Feb 14, 2021 10:54 pm

OhNoWhatAboutWhenYouGetACasesensitiveoperatingSYstemLIKEAndroid.txt ?

Typo nightmares!

It's bad enough with specialFolderPath("Documents") failing.

Post Reply

Return to “Off-Topic”