import "./relative/path"import "logical/path"
// main.wrenimport "./dir/other"// dir/other.wrenFiber.abort("oops")
$ wren main.wren
oops[./dir/other line 1] in (script)[./main line 1] in (script)
[some_package:path/in/package line 234][relative/path/thing line 1] in (script)[main line 1] in (script)
How about transforming relative path to absolute since users will use that to watch/fix code?
--
You received this message because you are subscribed to the Google Groups "Wren" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wren-lang+...@googlegroups.com.
To post to this group, send email to wren...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wren-lang/CAAZ5spDWDPuzAibYhbcX4n_MLa%3Di0dA5J6HQAmoB28ceBch4dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/wren-lang/CAOHyZoZ34aBc1YRJT5wh8VyExv1cUE5yFxdiT2FzYO4UWjTJZQ%40mail.gmail.com.
How about transforming relative path to absolute since users will use that to watch/fix code?
Regarding the uniqueness of the key, I can't recall off hand if the details work this way and I'm in a hurry but:
folderA/some/script.wren
folderA/some/importscript.wren //uses ./script.wren
folderB/other/script.wren
folderB/other/importscript.wren //uses ./script.wren
Are both paths here the same key ("./script.wren") and would this prevent the second one reaching the correct code?
// main.wrenimport "./folderA/some/importscript.wrenimport "./folderB/some/importscript.wren// folderA/some/importscript.wrenimport "./script"// folderA/some/script.wrenSystem.print("A's script")// folderB/other/importscript.wrenimport "./script"// folderB/other/script.wrenSystem.print("B's script")
./main.wren./folderA/some/importscript.wren./folderA/some/script.wren./folderB/other/importscript.wren./folderB/other/script.wren
On Sun, Jul 15, 2018 at 9:47 AM, Michel Hermier <michel....@gmail.com> wrote:How about transforming relative path to absolute since users will use that to watch/fix code?That's what Dart does and I've always found it annoying. You end up with stack traces like:oops[/Users/myusername/where/i/keep/my/code/my_app/dir/other line 1] in (script)[/Users/myusername/where/i/keep/my/code/my_app/main line 1] in (script)
Cheers!– bob
--
You received this message because you are subscribed to the Google Groups "Wren" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wren-lang+...@googlegroups.com.
To post to this group, send email to wren...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wren-lang/CAMu6JH-KoXmD-Wp%3D%2BuGh%2B5iqN1FaXa%2BB4ACqrjtRv41aShmCog%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Wren" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wren-lang+...@googlegroups.com.
To post to this group, send email to wren...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wren-lang/CAMu6JH-KoXmD-Wp%3D%2BuGh%2B5iqN1FaXa%2BB4ACqrjtRv41aShmCog%40mail.gmail.com.
Unfortunately a lot of IDEs don't allow you to be more specific (they are a simple regex filter on the output window).
Le dim. 15 juil. 2018 à 23:12, Bob Nystrom <munifi...@gmail.com> a écrit :
On Sun, Jul 15, 2018 at 9:47 AM, Michel Hermier <michel.hermier@gmail.com> wrote:How about transforming relative path to absolute since users will use that to watch/fix code?That's what Dart does and I've always found it annoying. You end up with stack traces like:oops[/Users/myusername/where/i/keep/my/code/my_app/dir/other line 1] in (script)[/Users/myusername/where/i/keep/my/code/my_app/main line 1] in (script)
It is not an annoyance: it is meant to be correctly identified without ambiguity, copy pastable, or parsable by the UI of the frontend.
oops[/Users/myusername/where/i/keep/my/code/my_app/dir/other line 1] in (script)
[random line 123] in blah()
[/Users/myusername/where/i/keep/my/code/my_app/main line 1] in (script)
[some/package line 123] in blah()
Regarding stack traces.
I threw an abort in a random place and copy pasted what I see.
As mentioned before, I use .wren explicit extensions on relative files, and use "package: some/path" as a logical one.I still like this approach. I chose it based a little on dart but with an enforced space for consistency and clarity.I also chose it because colon is invalid in many contexts where a path may originate from, like urls, files/folders, networks etc.It's trivial to identify the difference too, with an index of type check.
Note - In my case they're always relative to the project root, until relative resolve lands.
If I import with the ./ it shows up there, as expected.I like this because it's clear where the code is from (my code? someone else's code?).> [Error] eh?[app/app.wren line 16] in color=(_)[game.wren line 17] in init ready()[game.wren line 92] in[luxe: project line 644] in launch_game()[luxe: project line 518] in entry()
Some important notes:
IDEs and path resolution.In sublime or vscode for example, I have it so if I double click on the error (["game.wren line 17"] line) it will jump to that file, opening it if necessary.If that file doesn't exist (like `luxe: project` is not a valid file) this becomes a usability annoyance, you can't jump to errors in packages.This can be solved by a `resolve to real path or null type function` which we also have to use in the debugger, but IDEs can't call that.
IDEs and shared plugin/consistencySince the embedder can decide how the error output looks, the error matching regex is specific to the embedder.
This means that if an error output is different from the default wren / cli approach, a "wren support for vscode" won't catch the errors either.
I agree that ":" in filenames in VM output would be a bit of a pain. But full absolute paths are also annoying since you have to be careful about redacting them when copying them into a public bug report.
On Sunday, July 15, 2018 at 2:36:20 PM UTC-7, Sven Bergström wrote:Unfortunately a lot of IDEs don't allow you to be more specific (they are a simple regex filter on the output window).The user, IDE, or some combination of both will need to be able to resolve filenames in both import statements and in VM output.In the output, I think this could be fixed by making all paths relative to a single directory? It doesn't need to be root. One possibility would be to make them relative to the current working directory at startup, unless the embedder changes this.
If IDE's are okay with using two regexps to get absolute paths, then starting all module files with "wren_modules/" and other files with "./" in the VM output might work well.
[app/app.wren line 16] in color=(_)[game.wren line 17] in init ready()[game.wren line 92] in[luxe: project line 644] in launch_game()[luxe: project line 518] in entry()
import "luxe: project"import "luxe/project"
import "foo: foo"import "foo/foo"
import "foo"
--
You received this message because you are subscribed to the Google Groups "Wren" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wren-lang+...@googlegroups.com.
To post to this group, send email to wren...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wren-lang/CAMu6JH9-P6D5fy4-HJnySOJOKSQGoavDxRtYTeZNMQdkbZbt%2BQ%40mail.gmail.com.
yea,
package: file
package: folder/file
essentially, the extension is just removed, and the package part is resolved from a folder (like wren_modules or in this case the engine installation for the version that the project has a dependency on. So if you had say, mypackage: file, that would resolve to something like <path>/packages/mypackage/1.0.0/file.wren.
There's a tad more nuance to mine (like how the packages are structured instead of at the root) but that's the idea atm.import "luxe: math" for Mathimport "luxe: input" for Inputin image form with highlighting: https://i.imgur.com/6a7bg1N.png
To view this discussion on the web visit https://groups.google.com/d/msgid/wren-lang/CAOHyZoZzGt-rK_4-HMNPTfcM14huOyerrdA2LD4stdYdQ4%3D%2B%3DA%40mail.gmail.com.
yea,
package: file
package: folder/file
essentially, the extension is just removed, and the package part is resolved from a folder (like wren_modules or in this case the engine installation for the version that the project has a dependency on. So if you had say, mypackage: file, that would resolve to something like <path>/packages/mypackage/1.0.0/file.wren.
There's a tad more nuance to mine (like how the packages are structured instead of at the root) but that's the idea atm.import "luxe: math" for Mathimport "luxe: input" for Inputin image form with highlighting: https://i.imgur.com/6a7bg1N.png
≥Secondly, since I'm working in terms of an API, there isn't import "package" right now.I can see that resolving to some module.wren/lib.wren/index.wren type thing later.
But, I tend toward explicit/clear over implicit, and the inconsistency between "package: stuff" and "package" I don't like.I'd rather keep them all consistent personally. so a single file inside a package is just "package: file".
≥
Since I prefer all paths (in a project) are absolute to the project root, I don't have file-relative imports.
I won't prevent file relative when I merge with master, I'll see how it feels but it's a user directed choice if it just works.
In my case file relative and project relative are distinct too. "./file-relative.wren" and "project-relative.wren" are separate right now.
The relative becomes more important for packages themselves.
To add, my approach is more exploring while I work and settling on a final decision when I get there.
So far, I like how it feels and how it works and have been using it as is the last > year+.We're soon working on a wren implementation of the pub solver from newest dart,which around then I'll actually start looking at it more closely.