2

印刷してみます

| req |
req := XMLHttpRequest new.
req open: 'GET' url: 'http://www.stackoverflow.com/' asynchronous: false.
req send: ''.
req responseText

デバッガーが教えてくれます

[Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location:
"JS frame ::   http://amber-lang.net/amber/js/boot.js :: callJavaScriptMethod ::
 line 651" data: no]

これは、 http://amber-lang.net/の現在の amber IDE のワークスペースで発生します。

ノート:

JavaScript メッセージを翻訳しました

req.open("GET", url, false); 

http://amber-lang.net/documentation.html#JSObjectProxyに記載されているメッセージ変換規則に従って

SLaks による回答後に更新

次のコード スニペット

| req |
req := XMLHttpRequest new.
req open: 'GET' url: 'http://amber-lang.net/' asynchronous: false.
req send: ''.
req responseText 

http://amber-lang.netから開いた IDE で実行すると、実際に動作します。

答えは

'<!DOCTYPE html>
<html>
  <head>
    <title>Amber Smalltalk</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="author" content="Nicolas Petton" />

 ....
4

1 に答える 1