dreymonde
(Oleg Dreyman)
January 20, 2018, 6:46pm
1
I think there is a problem that doesn’t get much attention: two major Swift projects, Swift Package Manager and Swift REPL , having a really hard time working together. It is so tempting to use REPL with Swift PM built packages, but currently you still have to make an unnecessary big amount of movements for this:
This question was already raised previously:
opened 11:53AM - 08 Apr 16 UTC
closed 09:07PM - 01 Dec 17 UTC
bug
| | |
|------------------|-----------------|…
|Previous ID | SR-1191 |
|Radar | None |
|Original Reporter | dreymonde (JIRA User) |
|Type | Bug |
|Status | Resolved |
|Resolution | Won't Do |
<details>
<summary>Environment</summary>
OS X 10.11, DEVELOPMENT-SNAPSHOT-2016-03-24-a
</details>
<details>
<summary>Additional Detail from JIRA</summary>
| | |
|------------------|-----------------|
|Votes | 2 |
|Component/s | LLDB for Swift, Package Manager |
|Labels | Bug, REPL |
|Assignee | None |
|Priority | Medium |
md5: ac28f4342824c5000f6ec58e6cf6e10f
</details>
**relates to**:
* [SR-1573](https://bugs.swift.org/browse/SR-1573) A way to launch swift REPL with all swift modules in a package
**Issue Description:**
SPM built modules are unable to use with REPL.
``` java
$ swift build
Compiling Swift Module 'Analysis' (7 sources)
$ swift -I .build/debug
```
import statement works, but then error occurs:
``` java
1> import Analysis
2> let list: List = [2, 3, 4]
list: Analysis.List = {
elements = <extracting data from value failed>
}
error: Couldn't lookup symbols:
__TMO8Analysis9DataPoint
__TFO8Analysis9DataPointCfT14integerLiteralSi_S0_
__TFV8Analysis4ListCft12arrayLiteralGSaOS_9DataPoint__S0_
```
*UPDATE*
Error descriptions on Linux seems to be more informative:
``` java
swift -L .build/debug -I .build/debug
Welcome to Swift version 3.0-dev (LLVM b010debd0e, Clang 3e4d01d89b, Swift 7182c58cb2). Type :help for assistance.
1> import Analysis
2> let list: List = [1, 2, 3, 4, false, "string"]
list: Analysis.List = {
elements = <extracting data from value failed>
}
error: Couldn't lookup symbols:
Analysis.List.init (arrayLiteral : Swift.Array<Analysis.DataPoint>...) -> Analysis.List
Analysis.DataPoint.init (booleanLiteral : Swift.Bool) -> Analysis.DataPoint
Analysis.DataPoint.init (integerLiteral : Swift.Int) -> Analysis.DataPoint
type metadata for Analysis.DataPoint
Analysis.DataPoint.init (stringLiteral : Swift.String) -> Analysis.DataPoint
```
opened 06:54PM - 20 May 16 UTC
closed 10:53PM - 29 Sep 18 UTC
enhancement
| | |
|------------------|-----------------|…
|Previous ID | SR-1573 |
|Radar | rdar://problem/44889181 |
|Original Reporter | @aciidb0mb3r |
|Type | New Feature |
|Status | Resolved |
|Resolution | Done |
<details>
<summary>Additional Detail from JIRA</summary>
| | |
|------------------|-----------------|
|Votes | 3 |
|Component/s | Package Manager |
|Labels | New Feature |
|Assignee | None |
|Priority | Medium |
md5: 73a19b22b0ad0f3cafced2c8edd6900f
</details>
**relates to**:
* [SR-1191](https://bugs.swift.org/browse/SR-1191) Failed to use REPL with SPM built modules
**Issue Description:**
It'll be nice to be able to launch REPL with all the modules inside a package with a command like:
$ swift build --repl
One issue currently is that a module needs to have a dylib to be able run in REPL. Maybe we can generate dylibs for all the modules when user launches this mode?
Some reference here : <https://bugs.swift.org/browse/SR-1191>
And some effort was made, but, unfortunately, it wasn’t finished:
apple:master
← bhargavg:repl
opened 11:57AM - 04 Jun 16 UTC
This patch adds `repl` sub command to `swift build` that can launch REPL with al… l the modules linked.
Dependencies:
- [x] Merging of #388
It would be so great to have the ability to just run swift build repl
(which would configure everything and open up REPL ready for import
) — it would open up great possibilities for prototyping, exploring and testing packages.
2 Likes
Aciid
(Ankit Aggarwal)
January 22, 2018, 8:50pm
2
I agree that we should implement this but it is not a priority right now. Meanwhile, if someone from the community wants to take a stab at implementing this, I am happy to assist!