Scala Website Source Code

repository·main·Indexed 43 days ago

https://github.com/scala/scala-lang

Source code for the official scala-lang.org website, built using Jekyll. Includes documentation for contributing events, blog posts, and training sessions, as well as instructions for building the site using Docker Compose or Bundler. Contains details on the jekyll-tabs-lib plugin and archive information for Scala versions 2.10.1 and 2.11.0-RC1.

Tokens
122.1K
Snippets
328
Records
679
Agent score
48%

What's inside Scala

  1. Overview of jekyll-tabs-lib for docs.scala-lang.org

    main

    The jekyll-tabs-lib is a Jekyll plugin used to create tabbed content interfaces on the docs.scala-lang.org website. It is a modified version of the original jekyll-tabs plugin, adapted specifically to match the existing HTML structure of the Scala documentation site.

    Key differences from the original plugin include:

    • ID Generation: Instead of using secure random UUIDs, the tabs ID is derived from the provided name parameter.
    • Custom Styling: The tabs block supports an optional second parameter for custom CSS classes.
    • Parameter Ordering: In the tab block, the tab label is the first parameter, followed by the name of the parent tabs block.
    • Default Tab Behavior: The tab block includes a defaultTab attribute. If not explicitly set, the final tab in the group becomes the default.
  2. Overview of Scala.js

    main

    Scala.js is a compiler that translates Scala code into optimized, minimized JavaScript (ECMAScript 5.1). It allows developers to run Scala in any environment that supports JavaScript, including web browsers and Node.js.

    Key features include:

    • Full Scala Language Support: Includes type inference, classes, traits, pattern matching, and the collections library.
    • JavaScript Interoperability: Can interact with JavaScript libraries either statically (via typed facades) or dynamically (using js.Dynamic).
    • Code Sharing: Enables sharing code between client and server environments.
    • Source Maps: Emits source maps so you can debug your original Scala code directly in a browser's developer tools.
  3. Overview of Saddle Data Manipulation Library

    main

    Saddle is a high-performance data manipulation library for Scala designed for structured data on the JVM. It provides:

    • Data Structures: Array-backed, indexed, one- and two-dimensional structures.
    • Numerical Computing: Vectorized numerical calculations and automatic data alignment.
    • Robustness: Built-in handling for missing values.

    It is intended to be an expressive way to program with structured data using advanced Scala features like the typeclass pattern and specialization.

  4. Key features of Scala.js

    main

    Scala.js provides several core capabilities for Scala developers targeting the web:

    • Scala Compatibility: Supports all of Scala, including macros (subject to some semantic differences).
    • JavaScript Interoperability: Allows using JavaScript libraries (like jQuery) and HTML5 APIs from Scala code in both typed and untyped ways. It also allows calling Scala.js objects from JavaScript.
    • Build Tool Integration: Fully integrated with sbt, supporting dependency management and incremental compilation.
    • Debugging Support: Generates Source Maps, enabling you to step through your original Scala code directly within a web browser's developer tools.
    • Production Optimization: Integrates with the Google Closure Compiler to produce minimal, optimized JavaScript code for production environments.
  5. Understand the Scala 2024 Roadmap priorities

    main

    The Scala Center's 2024 roadmap focuses on four main pillars: Language/Compiler/Standard Library, Documentation, Developer Experience, and Community/Contributor Experience. Key initiatives include:

    Language & Compiler

    • Unfreezing the Standard Library: Moving away from strict forward binary compatibility to allow new classes and members.
    • Scala.js Minification: Implementing Scala.js-specific optimizations to reduce bundle sizes for ECMAScript modules.
    • Build Time Improvements: Polishing compiler performance and investigating parallelization.

    Documentation

    • New Getting Started Experience: A new learning path centered around the new scala command (SIP 46).
    • Standard Library API Enhancements: Adding complexity guarantees, tradeoff descriptions, and better Java standard library references.
    • Cookbook Content: More tutorials for concrete problems (e.g., writing an HTTP server).
    • Scala 3 Macro Guide: Practical examples for match types, typeclass derivation, and metaprogramming.

    Developer Experience

    • sbt 2: Active development focusing on Scala 3 support, simplification, and performance.
    • Metals & Bloop Reliability: Improving error reporting and addressing frequent crashes.
    • Scalafix: Porting ExplicitResultType and RemoveUnused rules to Scala 3.
    • Metals Debugger: New features including pretty stack traces (Scala 3), hot-code reload, and a runtime evaluator.

    Community

    • Google Summer of Code: Supporting new programmers through community projects.
    • Scala Ambassador Program: Providing toolkits for local community leaders to organize events.
    • Contribution Equals Impact: Resources for companies to participate more effectively in open source.
  6. New features and improvements in Scala 3.3.4 LTS

    main

    Scala 3.3.4 is a Long Term Support (LTS) release that incorporates many improvements from the Scala Next series (up to Scala 3.5.1). Key updates include:

    • JDK Support: Support for JDK 22.
    • Java Interop: Support for JEP-409 (sealed classes) in mixed Java/Scala codebases.
    • Tooling & IDEs: Improved compilation progress tracking and cooperative interruption (cancellation) support. This fixes issues in Metals (where progress would freeze at 0% when using sbt or bloop as the BSP server) and improves progress reporting in IntelliJ for BSP and sbt-based projects.
    • Compiler Flags & Warnings:
      • -Ybackend-parallelism:N: Support for a parallel JVM backend.
      • -Xlint:private-shadow: Warns when a private field or class parameter shadows a superclass field.
      • -Xlint:type-parameter-shadow: Warns when a type parameter shadows a type already defined in the scope.
      • New warnings for anonymous classes in inlined methods to prevent JVM meta-space pressure.
      • New warnings for extension receivers that have a defined non-private member of the same name and a subsuming signature.
    • Coverage: Support for coverage filter options under -coverage-exclude-packages and -coverage-exclude-files.
    • Library Updates: Upgrade of the Scala 2 library to version 2.13.14.
  7. New features in Scala 2.12.0

    main

    Scala 2.12.0 introduces significant improvements leveraging Java 8 VM features:

    Improved Java Interop

    • Traits to Interfaces: Traits now compile directly to Java interfaces with default methods, improving binary compatibility and Java interoperability.
    • Lambda Syntax for SAM Types: The FunctionN classes in the standard library are now Single Abstract Method (SAM) types. This allows for improved Scala/Java 8 interop using lambda syntax. No class file is generated for lambdas; invokedynamic is used instead.

    New Optimizer

    • Inlining: More final methods (including those in objects and traits) are now inlined.
    • Allocation Reduction: Improved elimination of closure allocations, dead code, and box/unbox pairs.
  8. Use scalac-profiling to analyze compilation slowdowns

    main

    The scalac-profiling tool is a Scala Center compiler plugin designed to help developers identify what is slowing down compilation in their projects. It specifically targets inefficiencies caused by:

    • Implicit searches: Unnecessary or complex implicit lookups.
    • Macro expansions: Heavy use of macros, particularly those triggered by typeclass derivation (common in libraries like Shapeless).

    By using this plugin, you can detect when these mechanisms are being triggered excessively and optimize your code to reduce compile times. While this blog post provides a historical walkthrough, a dedicated documentation site is available at https://scalacenter.github.io/scalac-profiling/.

  9. Key Scala 3 features and tooling requirements

    main

    Based on community survey results, the following features and tools are central to the Scala 3 ecosystem:

    High-Interest Features

    • Core Language Features: Enums, union and intersection types, and extension methods.
    • Type System Improvements: Opaque type aliases, type class derivation, explicit nulls, given/using syntax, match types, top-level definitions, polymorphic function types, and multiversal equality.

    Essential Tooling

    • Build Tools: sbt is the primary build tool, but support for Maven, Gradle, and Bazel is also critical.
    • IDE Support: IntelliJ is a primary requirement for a productive Scala 3 experience.
    • Formatting & Linting: Scalafmt and Scalafix are the most important tools, though Scapegoat and Scalariform are also used.
    • Other Ecosystem Components: Scala.js, Scala Native, and Ammonite.
  10. Features in the Dotty 0.2.0-RC1 technology preview

    main

    The Dotty 0.2.0-RC1 technology preview includes several language features planned for Scala 3 and various stability improvements.

    New Language Features:

    • Intersection Types
    • Union Types
    • Trait Parameters
    • Enumerations
    • Algebraic Data Types
    • By-Name Implicits

    Key Improvements:

    • Stability & Reliability: Optimizing pattern matcher, idempotency checks for reproducible builds, and faster base class sets.
    • IDE & Language Server: Improved VS Code plugin support (including Windows), fixed hover functionality for enums and implicitly converted expressions, and better 'find all references' in external projects.
    • Compatibility: Support for Scala 2.12 traits and improved handling of Scala 2 classfiles and Java generic signatures.
    • Error Messages: Improved clarity for implicit function types, nonsensical modifier combinations, and supercalls inside @inline methods.
    • Type System: Better handling of wildcard types in unions and intersections.
  11. New features in Scala 3.4.0

    main

    Scala 3.4.0 introduces several stabilized features and improvements:

    Stabilized SIPs

    • SIP-54 (Multi-source extension overloads): Allows importing extension methods with the same name from different sources.
    • SIP-53 (Quote pattern type variable syntax): Enables more expressive type patterns in quotes. Example: case '[ (t, t, t) ] => ??? matches any 3-element tuple where t is the greatest lower bound of the elements.
    • SIP-56 (Match types): Match types are now properly specified for more predictable behavior.

    Type System & Inference Improvements

    • Improved Fold Inference: Type inference for functions similar to fold is improved. For example, xs.foldRight((Nil, Nil)) will correctly infer (List[T], List[T]).
    • Concise Polymorphic Lambdas: You can now omit type parameters for polymorphic lambdas if they can be inferred from context.
      • Before: val f: [T] => T => String = [T] => (x: T) => x.toString
      • Now: val f: [T] => T => String = [T] => x => x.toString

    Backend & Reporting

    • Efficient Lambdas: Polymorphic lambdas use JVM lambdas instead of anonymous classes where possible.
    • Improved Error Messages: Better diagnostics for incompatible TASTy versions and JDK/classfile version mismatches.
    • IDE Integration: Compilation progress is now visible in Metals and IntelliJ when using BSP/sbt/bloop.
  12. Understand the Scala Center 2023 Roadmap

    main

    The Scala Center's roadmap focuses on improving the experience of becoming and being a Scala developer. The primary goals are organized into four pillars:

    1. Language, Compiler, and Standard Library: Improving compiler error messages, providing structured output for IDEs (Metals/IntelliJ), unfreezing the standard library to allow new members/classes, and clarifying the Scala 3 roadmap.
    2. Documentation and MOOCs: Shifting toward 'task-oriented' documentation (e.g., tutorials for JSON or testing) and improving the 'Effective Programming in Scala' course.
    3. Developer Experience: Streamlining cs (Coursier) distribution, reducing IDE import complexity, improving Scala 3 support in Metals/IntelliJ, and maintaining core tools like Bloop, sbt, and scala-debug-adapter.
    4. Community and Contributor Experience: Organizing Scala Days and Tooling Summits, improving Scastie support for standalone programs via Scala CLI directives, and publishing TASTy-MiMa for incompatibility detection.