0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VB.NET 4.8.1を今の時代に触る!!PHP 8.x, TypeScript 5.xとの言語仕様比較(第1章 概要)

0
Last updated at Posted at 2025-12-27

目次

第1章 概要

1.1 各言語の設計思想と歴史

PHP 8.x

  • 誕生: 1995年、Rasmus Lerdorfによって開発
  • 設計思想: Web開発に特化したサーバーサイドスクリプト言語
  • 特徴:
    • 「Simple things should be simple」
    • 動的型付けからの漸進的な型システム強化
    • PHP 8.0でJITコンパイラ導入

TypeScript 5.x

  • 誕生: 2012年、Microsoftによって開発
  • 設計思想: JavaScriptに静的型付けを追加
  • 特徴:
    • JavaScriptの厳密なスーパーセット
    • 型安全性とIDEサポートの強化
    • コンパイル時の型チェック、実行時はJavaScript

VB.NET 4.8.1

  • 誕生: 2002年、.NET Frameworkと共にリリース
  • 設計思想: Visual Basic 6からの移行パス、.NETプラットフォームへの統合
  • 特徴:
    • 英語に近い可読性の高い構文
    • 完全なオブジェクト指向
    • .NET Framework/CLR上で動作

1.2 実行環境

項目 PHP 8.x TypeScript 5.x VB.NET 4.8.1
実行形式 インタプリタ(JIT対応) トランスパイル→JavaScript コンパイル(IL→JIT)
ランタイム Zend Engine Node.js/ブラウザ .NET Framework CLR
配布形式 ソースコード JavaScript アセンブリ(.exe/.dll)

PHP

# 直接実行
php script.php

# 組み込みサーバー
php -S localhost:8000

TypeScript

# コンパイル
tsc script.ts

# 実行(Node.js)
node script.js

# ts-nodeで直接実行
ts-node script.ts

VB.NET

# コンパイル
vbc /out:Program.exe Module1.vb

# MSBuildでビルド
msbuild Project.vbproj

# 実行
Program.exe

1.3 型システムの分類

言語 型付け 型チェック時点 型推論
PHP 8.x 動的(漸進的型付け対応) 実行時 なし(型宣言は任意)
TypeScript 5.x 静的 コンパイル時 あり
VB.NET 4.8.1 静的(Option Strictによる) コンパイル時 あり(Option Infer)

PHP - 動的型付け + 型宣言

// 型宣言なし(動的)
function add($a, $b)
{
    return $a + $b;
}

// 型宣言あり(PHP 7.0+)
function addTyped(int $a, int $b): int
{
    return $a + $b;
}

// Union型(PHP 8.0+)
function process(int|string $value): void
{
    // ...
}

TypeScript - 静的型付け

// 明示的な型注釈
function add(a: number, b: number): number {
    return a + b;
}

// 型推論
const result = add(1, 2); // number型と推論

// Union型
function process(value: number | string): void {
    // ...
}

VB.NET - 静的型付け

' 明示的な型宣言
Function Add(a As Integer, b As Integer) As Integer
    Return a + b
End Function

' 型推論(Option Infer On)
Dim result = Add(1, 2) ' Integer型と推論

' Option Strict Off の場合は暗黙的な型変換を許可
Option Strict Off
Dim x = "123"
Dim y As Integer = x ' 暗黙的に変換

第2章 基本構文

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?