Dots and Slashes: The Hyphen and Colon Disruption

I'd gotten the idea in my head from looking at code that dots were superior to slashes for field selection.

I do think it looks less noisy in basic cases:

if system.options.quiet [print "Be quiet!"]

if system/options/quiet [print "Be quiet!"]

But when you combine it with colons, it's a little less obvious:

system.options.quiet: true

system/options/quiet: true

The dot doesn't contrast as well with the colon as the slash does. It's a little close to system.options.quiet.

Another issue is how the dot doesn't stand out quite as much from dash as a slash does:

system.console.print-info "Scans kind of like (system.console.print)-info"

system/console/print-info "More obvious scan as system/console/(print-info) ?"

But it probably as a lot to do with "what you're used to". We certainly are able to group together hyphenated clauses in filenames all the time, like some-file.txt so I am probably just being a bit jarred by seeing a new pattern. Looking at it side-by-side here, I guess you could probably just as easily see the -info as being broken off from the slashes if you wanted to see it that way...

Overall, I feel like the benefit of distinguishing function refinements from field selection is high enough to warrant shifting to dots. But I just was a bit surprised that I didn't instantaneously think it was 100% better-looking. :-/

1 Like

Bolstering my instincts here is that in Carl's latest "AltScript" side project, he has caved to the use of dots for field selection:

"Dots are used for field selection. For example, “person.name” refers to the name field of the person object. Slashes are not used for selection. Use of a dot for selection is common in many other languages."

I've gone ahead and made UPARSE a first guinea pig of the slash-to-dot conversion, which meant fixing some binding features so it could work.

I think it's an improvement, helping make it clearer when things are function calls vs. field selections.