Skip to content

Conversation

Copy link

Copilot AI commented Sep 26, 2025

This PR addresses the request to align Rust and C++ examples with JavaScript functionality and split C++ into separate C++11 and C++23 versions for better language comparison.

Changes Made

🦀 Rust Examples Completion

Previously, many Rust sections were empty or incomplete. This PR adds comprehensive Rust implementations for all programming concepts, including:

  • IIFE: Implemented using closures since Rust doesn't have traditional IIFE
  • Classes: Used struct + impl blocks with traits for inheritance patterns
  • JSON handling: Added serde-based serialization/deserialization examples
  • Error handling: Demonstrated Rust's Result<T,E> pattern instead of exceptions
  • Regular expressions: Added regex crate usage examples
  • Time operations: Comprehensive time handling with std::time and chrono
  • System variables: Process, environment, and filesystem operations

⚡ C++ Version Split

Replaced the single C++ implementation with two distinct versions showcasing language evolution:

C++11 Features:

  • Auto type deduction and uniform initialization
  • Lambda functions and range-based for loops
  • Smart pointers and modern STL containers
  • Enhanced enum classes

C++23 Features:

  • Concepts and ranges library
  • Format library and structured bindings
  • Spaceship operator and enhanced enums
  • Expected types and modern error handling

🌐 Enhanced Language Support

  • Before: 4 languages (TypeScript, Golang, Rust*, C++*) with incomplete coverage
  • After: 5 languages (TypeScript, Golang, Rust, C++11, C++23) with comprehensive examples

*Previously had many empty sections

Technical Implementation

  • Updated scripts/define.js to define C++11 and C++23 as separate languages
  • Created new data files: data.cpp11 and data.cpp23
  • Removed old data.cpp file
  • Enhanced data.rs with missing implementations
  • Regenerated HTML comparison table and README.md

Screenshot

Language Comparison Table

The comparison table now provides complete side-by-side examples across all 5 languages, making it easier for developers to understand syntax differences and similarities when working across multiple programming languages.

Verification

  • ✅ All builds pass successfully
  • ✅ HTML output generates correctly with all 5 languages
  • ✅ README.md updated with comprehensive examples
  • ✅ Interactive comparison table works as expected

This enhancement significantly improves the utility of the language comparison tool by providing complete, idiomatic examples for each supported programming language.

Original prompt

This section details on the original issue you should resolve

<issue_title>更多语言实例</issue_title>
<issue_description>帮我把 rust 和 c++ 的示例对齐 JavaScript 。
另外吧 c++ 拆分成两种,c++11 和 c++23。
</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #4

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: echosoar <14832743+echosoar@users.noreply.github.com>
Copilot AI changed the title [WIP] 更多语言实例 Align Rust and C++ examples with JavaScript and split C++ into C++11/C++23 versions Sep 26, 2025
Copilot AI requested a review from echosoar September 26, 2025 07:05
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

Successfully merging this pull request may close these issues.

更多语言实例

2 participants