Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Roadmap #96

Open
48 of 54 tasks
joshgoebel opened this issue Apr 28, 2021 · 7 comments
Open
48 of 54 tasks

API Roadmap #96

joshgoebel opened this issue Apr 28, 2021 · 7 comments

Comments

@joshgoebel
Copy link
Contributor

joshgoebel commented Apr 28, 2021

A thread to track the overall API roadmap for the CLI.

IO

Directory

  • create
  • remove
  • exists
  • list

File

  • static create(path)
  • static create(path,fn)
  • static delete(path)
  • static exists(path)
  • static open(path)
  • static open(path,fn)
  • static openWithFlags(path, flags)
  • static openWithFlags(path, flags, fn)
  • static read(path)
  • static realPath(path)
  • size(path)
  • close()
  • size()
  • stat()
  • readBytes(count)
  • readBytes(count,offset)
  • writeBytes(bytes)
  • writeBytes(bytes, offset)

FileFlags

  • static readOnly { 0x01 }
  • static writeOnly { 0x02 }
  • static readWrite { 0x04 }
  • static sync { 0x08 }
  • static create { 0x10 }
  • static truncate { 0x20 }
  • static exclusive { 0x40 }

Stat

  • static path(path
  • blockCount
  • blockSize
  • device -> isDevice
  • group
  • inode
  • linkCount
  • mode
  • size
  • specialDevice -> isSpecialDevice
  • user
  • isFile
  • isDirectory

Stdin

Stdout

  • flush

OS

Platform

Process

Scheduler

  • static add(callable)
  • runNextScheduled_(fiber) - not really private cause we call it everwhere

Timer

  • sleep -> Scheduler.sleep ???
@joshgoebel
Copy link
Contributor Author

Thoughts/ideas just at a glance:

  • move sleep from timer into scheduler
  • move version to Wren proper System.wrenVersion
  • Process.cwd -> Directory.currentWorking, although this starts to get into how we organize
  • Scheduler.runNextScheduled_ => runNext() (scheduled is implied, it's the scheduler)
  • device and specialDevice get the is prefix

@clsource
Copy link

I think Directory.remove and File.delete should be both named Directory.delete and File.delete. to be more consistent.

@PureFox48
Copy link

I don’t think it’s a good idea to move the sleep method to the Scheduler class.

Firstly, it’s the fiber from which it’s called that sleeps, not the Scheduler which takes the opportunity to run the fibers in its list one after the other.
However, you can’t put it in the Fiber class because it’s only available in the CLI. Hence the creation of the Timer class.

Secondly, it would break a ton of code. I use it all the time (no pun intended).

I have no strong feelings about the other proposed changes which have either not yet been included in a release version or will not have been used much anyway.

@joshgoebel
Copy link
Contributor Author

joshgoebel commented Apr 29, 2021

Secondly, it would break a ton of code. I use it all the time (no pun intended).

There are solutions to that - deprecating, supporting both for a while, etc. :-) IMHO absolute rock solid backwards compatibility shouldn't really be a major goal at this point though.... considering we're still 0.3, not even 1.0. Individual releases should be stable and people should realize it's in active development and things may change when upgrading to a new release. I've gotten very used to semantic verionsion (only break things in major) but I think when you're pre 1.0 that each minor release can have breaking changes.

it’s the fiber from which it’s called that sleeps, not the Scheduler

This is true, but:

  • Class static methods are not always noun verb, only when the class is serving as a singleton.
  • The Timer isn't really sleeping either. As you said Fiber would be more accurate.

In my mind scheduler is orchestrating the sleep... but I'm not super attached to moving it. Timer is ok. Some of these were just ideas. I just would like to try to focus more on "best long-term names for the API" hopefully though rather than "we called it that in version 0.1, now we're stuck". :-)

IE: If we had found consensus that say Scheduler was better/clearer naming then I think we should break thing and change it and then mention that in the release notes, etc...

@joshgoebel
Copy link
Contributor Author

joshgoebel commented Apr 29, 2021

I think Directory.remove and File.delete should be both named Directory.delete and File.delete. to be more consistent.

Just curious, why not remove for both? This may be a windows vs unix thing though lol... wasn't windows del and unix has always been rm?

@PureFox48
Copy link

Just curious, why not remove for both?

Because, for better or worse, File.delete already exists and so you’d be breaking existing code for no good reason.

If we were starting from scratch, I’d prefer remove myself though delete is fine too.

@PureFox48
Copy link

Incidentally, I’m not suggesting that you should never make breaking changes in a language which hasn’t yet reached 1.0 and is still being heavily developed. However, I think there should be a good reason for doing so and, in the case of the sleep method, I think it would be inappropriate to put it in the Scheduler class anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants