easybuild-org / easybuild-org/EasyBuild.FileSystemProvider

Explore the idea of returning `DirectoryInfo` or `FileInfo` instead of `string`

未关闭
#17 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
F#
星标
35
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

The more I use this project, the more I find myself needing to transform the `string` into a `DirectoryInfo` or `FileInfo` which better represents a directory or file.

Indeed, a `string` is not well typed in term of Domain and can be anything.

Access a the `string` representation from both these types is easy enough by using `.FullName` where the other direction is a bit more convoluted.

I am wondering if we should not convert the TP to expose these return type instead of the string.

Ideas:

1. We go full breaking change and only expose `DirectoryInfo` or `FileInfo` API
2. We look to see if it is possible make `RelativeFileSystem` and `RelativeFileSystem` take an argument to configure their output
3. We create 2 modules to split the API and the user can choose the version he prefers:

```fs
module EasyBuild.FileSystemProvider.Typed
// or
module EasyBuild.FileSystemProvider.Infos

type RelativeFileSystemProvider(config: TypeProviderConfig) =
// ...
// Returns `DirectoryInfo` or `FileInfo`

module EasyBuild.FileSystemProvider.UnTyped
// or
module EasyBuild.FileSystemProvider.Simple
// or
module EasyBuild.FileSystemProvider.Strings

type RelativeFileSystemProvider(config: TypeProviderConfig) =
// ...
// Returns `DirectoryInfo` or `FileInfo`
```

I think I am in favor of option 1, because if people want to access the string value they just need to add `.FullName` and it makes less code to maintain 😇

Note: In regard of https://github.com/easybuild-org/EasyBuild.FileSystemProvider/issues/3, I think we will expose these APIs:

```fs
Workspace.src.``.``

// One of these variations
Workspace.src.GetInfos()
Workspace.src.Infos()
```

@shayanhabibi @JordanMarr Any opinions?

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先检查 RelativeFileSystemProvider 和现有的字符串返回 API,然后比较 issue 中描述的三种兼容性选项。链接的 issue 3 可能会为提议的 GetInfos 或 Infos API 提供背景信息。当项目确定返回类型和 API 的策略,并记录其兼容性影响后,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
fsharp
领域
tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。