Skip to content

Path syntax addition #47

@Victorious3

Description

@Victorious3

In light of potentially using Princess as a shell replacement it would make sense to have something as crucial as paths and their manipulation as a language feature.

It could work like this:

let segment = "folder name"
let p1 = ./some_path/{segment}/more_path/
let p2 = #/root/path/{p1}/../up
let p3 = ./some_path/{segment}
let p4 = ./some\ path\ with\ spaces/
let p5 = ./"how about this"/instead
let p6 = ~/relative/to/home

Paths may be concatinated with other paths or alternatively strings directly.
A path would be introduced by either a unary #/ for absolute paths, ~/ for paths relative to the home directory or a ./ for paths relative to the current working directory.
The path ends with a space or alternatively a closing /.

Additonally one could support globs as part of paths:

for var p in ./some/path/*.txt {
    print(p)
}

These would return a special Glob structure instead of a Path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions