Skip to main content

Sophie

A programming language with:

  • Call-by-need (lazy) pure functions
  • Actor-based concurrency and interaction
  • A strong impredicative type system
  • Readable, intuitive syntax
  • Other innovative niceties

Sophie is named in honor of French polymath Sophie Germain.

Sophie started as a personal project for fun and learning, but is growing into something useful. The graphics features provide a nice diversion and opportunity to play with higher ideas than what typically comes up in the daily grind of professional coding. These days, Sophie is also a vehicle for solving Advent-of-Code puzzles.

When all is said and done, I'd like Sophie to be a viable alternative for learning (or deepening one's grasp of) comp-sci. The call-by-need pure-functional design gives Sophie a very different flavor from your average introductory language, but should produce excellent habits.

What's it look like?

The best answer is to look at the examples.

Syntax Highlighting

My aesthetic bends toward the Algol clade, such as Pascal, C, Perl, Python, and Ruby. Given that most programmers seem to learn Java and Python these days, this should not break too many brains. However, Sophie is an expression-oriented call-by-need language, so some things are bound look a bit more like SQL or Haskell.

It may seem a small thing, but algebra-style parentheses are much more clear to me than Lisp or Haskell style. I think that's also true for most of the world's programmers. Things are better when the notation does not interfere with understanding.

Installing

You can simply pip install sophie-lang which will get you going in a pinch, but it's probably a better experience to follow the slightly more involved directions in the manual.

How do I Learn Sophie?

  1. Read the docs
  2. Poke around the examples and grammar
  3. Contribute to the docs in the usual way.

It sure might be nice to have a Learn computer science with Sophie book on the coffee table, but that book has yet to be written. So the most likely direction is to set up some experimental instructional setting, and then take notes on how things go.

Syntax Highlighting

There is a basic highlighting grammar for vscode in the GitHub repository. If you clone the repository or download a release, then you can install the Sophie language extension directly from there.

Current Status

There is now a change log.

Some things are going well:

  • A native-code Virtual-Machine can run Sophie code at a respectable speed. It reads a "compiled" form which you can generate with a command-line like sophie -x your/sophie/program.sg > program.is.
  • Sophie has Turtle-graphics! (See here for examples.)
  • Sophie is interactive! See this guessing game or this Not-Quite-Pong game as examples.
  • The type-checker gives excellent feedback and cannot be fooled. Through abstract interpretation it completely rules out type errors. (Domain errors, such as division by zero, are still possible.)
  • The module system got an upgrade: there is now a notion of a system-package and the beginnings of a standard library.
  • The FFI: Sophie can call Python; Python can call Sophie; and Python can install I/O drivers into Sophie. The same FFI directives on the Sophie side interact properly with the native-code VM.
  • Compile-time error display is generally clear and informative.
  • Operator overloading works via double-dispatch. Thus, the standard modules for complex-numbers and 2d vectors both let you use ordinary arithmetic symbols to manipulate their respective data types.

Some things are in progress:

Certain things seem like nice ideas, but may not happen any time soon:

  • Variable-Arity Functions.
  • Ad-hoc polymorphic multi-methods.
  • List comprehension (expressions like [expr FOR name IN expr]) are removed from the syntax for now.

Why not just use Language X, Y, or Z?

Have you been paying attention?

Long-Term Plans

Use Sophie as a medium for explaining software concepts in talks and papers. Experience with audience reaction to the syntax and semantics of Sophie will guide further design development. Sophie also provides a convenient test-bed for learning and experimentation.

Metadata

Release files for sophie-lang 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sophie-lang 0.0.7
File Size Uploaded Provenance Actions
sophie-lang-0.0.7.tar.gz 85.4 kB Without provenance Details for sophie-lang-0.0.7.tar.gz

Release files / sophie-lang-0.0.7.tar.gz

Download URL sophie-lang-0.0.7.tar.gz
Size 85.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7606f95ecc45b698c9d2a8cf292decf6321ac4db3869103c3cd5dc99b9ad7a0f
BLAKE2b-256 checksum
How to use checksums
7f337d096d3b0b2175ca5a1fb758349b0fed2847c71ce949ea7c3adceb5edc93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.7

Security for sophie-lang 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page